根据下面这段话,让你完全掌握CSS盒模型(css box model)。As you can see, each box is made of layers. From the outermost to the innermost:
The margin is the space around the element. The larger the margin, the more space between our element and the elements around it. We can adjust the margin to move our HTML elements closer to or farther from each other.
The border is the edge of the element. It's what we've been making visible every time we set the border property.
The padding is the spacing between the content and the border. We can adjust this value with CSS to move the border closer to or farther from the content.
The content is the actual "stuff" in the box. If we're talking about a p
element, the "stuff" is the text of the paragraph.
You'll see abbreviations like TM, TB, andTP in the diagram. These stand for "top margin," "top border," and "top padding." As we'll see, we can adjust the top, right, left, and bottom padding, border, and margin individually.
css box model
clear elements:If you tell an element to clear: left, it will immediately move below any floating elements on the left side of the page; it can also clear elements on the right. If you tell it to clear: both, it will get out of the way of elements floating on the leftand right!
absolute position和static position有啥区别?
学习心得:The more you practice, the better you'll get.