CSS box model
Web design is a rectangular box for each element. What is the exact size of the box calculated, see the following figure:
If the user then Firebug (basic and front end will use the Firebug bar - sugar with tomatoes), will be very familiar with the chart below the.
This chart shows the role very well on any box on the page value.
Note that the above two examples, margin is white. Margin rather special, it does not affect the size of the box itself, but it will affect and the other contents of the box, so margin a box model of an important part.
The size of the box itself is calculated:
Width width + padding-left + padding-right + border-left + border-right
Height height + padding-top + padding-bottom + border-top + border-bottom
Value is not the case statement
If you do not declare padding or border, that they or the value is zero (css reset when used), or as the default browser (it may not be zero, especially those who often do not have to reset the form elements)
The default width of the block-level boxes
If you do not declare the width and the box is static or relative positioning, the width will remain 100% width, padding and border will promote inward rather than outward expansion.
However, if you explicitly set the width of the box 100%, then the padding will extend outward.
The lesson here being that the default width of a box isn't really 100% but a less tangible "whatever is left". This is particularly valuable to know, since there are lots of circumstances where it is immensely useful to either set or not set a width.
Note that the default width of the box is not really 100%, but the rest of the possible values (should be said that the width of the remaining real - sugar with tomatoes). Should understand the special value, because in many cases, it is to set / not set the width is very useful.
The biggest problem I encountered is the textarea (text box) elements, and they need to set the width to the desired "cols" attribute, and can not contain child elements. It is often necessary to set textarea width defined as 100%, but padding, they will extend the textarea width. Fixed-width environment, usually set to the appropriate pixel width, but widens the situation not so lucky.
The width of the box without absolute positioning
Not set the width of the performance of the absolute positioning of the box a little bit different. They just need to fit the width of the content they contain can be. Therefore, if the box is only one word, the box will be like as wide as the performance of that word. If the two words into the box width will increase accordingly. The situation is going to box the width of the width to 100% of the parent element (the nearest relative positioning of the parent element or browser window), then it will fold line.
On the box, the vertical expansion to accommodate the content contained is natural. Surprising, not only in the performance of different platforms with different text, different browsers handle this issue, there are many quirks.
No width of the floating box
Absolute positioning with no width as the box's performance. The width of the box contained only extended to the width of the content until the width of its parent element (parent element is not necessarily the relative positioning). As these non-vulnerability of the width of the box, we have to learn is the key mission mode when they can not rely, as the overall page layout. If floating a use as a sidebar, and expect that the internal elements (eg images) to be responsible for the width of containing it, you're asking for trouble.
Inline element is a box
Here has focused on block-level element box. It is easy to imagine the block-level elements of the box, but also inline element boxes. They can think for very long, narrow rectangle, they can have the same box as the other margin, padding he border
It looks bad to exercise off some understanding. As shown in the left margin to push the right side of the box, but only the first line effective, because it is the starting point of the box. the normal application of padding in the text of the upper or lower part, when folded it will ignore the row above the row to row padding and high (line-height) required position as a starting point. Transparent background effect to make look better.
Witnessed what
Composition of the page to see each individual "box" it? Try this line of code into the style sheet for the time being:
* (
border: 1px solid red! important;
)
Recommended links:
Games SIMULATION Catalogs
Visuanl C # 2005 Quick Start of the while statement (1)
Site Administration SPECIALIST
C language library function (G class letters) - 1
flv TO avi
How to Ubuntu equipment Chinese character library
C # LEARNING Notes (April 3)
"Digital water" wind and rain ahead
Shop Dictionaries Education
Flv to mp4 converter free download
Dialog box for further Study
Specialist Mathematics Education
What is mov
Removal of DW MX 2004 SUPPLEMENTARY table width
ps3 video Format