The default margin for body in CSSThe default margin setting for the body tag in the General browser is set to 8px, of course, different browsers will be set to different values, it is provided by the browser's User-agent-stylesheet, Some browser user-agent-stylesheet can be modified by the user, while some browsers do
eg
This is the text section.
1. In the first case:
Body has margin,html not padding:
You can see that no matter how big the body of the margin, the body and the HTML side of the paste.
2.html has padding;
When the HTML has padding, it will affect the
The body has the margin of margin by default. bodymargin
By default, the body has the margin of margin:Here is just a fact, that is, the body has a margin by default.The code example is
value can be a percentage, and the percentage is calculated based on the width of the parent element , which is set for the child element in Example 2 margin: 50% . The property value can be a CSS length unit and the value can be negative. The property value can be inherit .Margin OverlayNote: In normal document flow, the vertical arrangement of two block-level
CSS deep understanding of learning notes-margin and css learning notes-margin
1. margin and container size
Element size: ① visible size clientWidth (standard); ② occupying size
Margin and visual size: ① applicable to normal blo
CSS margin knowledge point and CSS margin knowledge point1. Percentage value of margin
Percentage of common elements relative to the containerElement width).
Here we set a container with a width and height of 800*600 on the outside of the image. Set img {
; margin: 0 auto ;}
If the elements on the page are both in the div label or other block elements and reasonably nested, we do not need to set the body {text-align: center }. You only need to set the corresponding div element margin: 0 auto. As described in the Code above, all the elements on the page are in the section p label, and you only need to center the se
-height ' property was zero, and it has neither top or bottom borders nor t Op or bottom padding, and it has a ' height ' of either 0 or ' auto ', and it does not contain a line box, and all of Its in-flow children ' s margins (if any) collapse.
1. There is no folding between the floating box and the other boxes. (Even the floating box does not collapse between the elements of its normal flow). For example, an outer edge collapse occurs between a parent element and a child element in the follow
About CSS margin merging and CSS margin Merging
First, it must be clear that only the vertical outer margin of the block boxes in the normal document flow will be merged. The margin between the inside box, floating box, or absolut
Css layout: negative margin and Other implementations; css layout: margin
I believe that you have encountered this kind of requirement in project development. One row is placed with X (X> 1) blocks and the spacing between adjacent blocks is the same.
This is probably the above. The following describes several implemen
Generally in CSS styles, use the margin property to set the margin. If you need only one side of the margin, you can use the unilateral margin property to set the value for the margin on the element's unilateral edge. Use the
An empty area around the border of an element is the margin. Setting the margin creates an extra "blank" outside the element.
The simplest way to set the margin is to use the margin property, which accepts any length units, which can be pixels, inches, millimeters, or em, percent values, or even negatives. In this pape
The CSS margin property defines the space around the element.
MarginMargin clears the area around the element (outer border). Margin has no background color and is completely transparentMargin can be changed individually on the top, bottom, left, and right margin of the element. You can also change all properties
CSS in the margin-top is set the distance between the outer space of the container, div nested, margin-top or margin-bottom invalid, in the online hit to the following method can be resolved. When designing a page, there's a magical question, and here's the code for the HTMLAt this point I set the style of the sub-cont
body,html /* Set the window div to browser size * /{ margin:0; padding:0; height:100%; }The following codeDOCTYPE HTML>HTMLLang= "en">Head>style>#side{float: Left;width:30%;Height:300px;Background-color:#99FF99; }#main{Margin-left:30%;width:70%;Height:300px;Background-color:#99FFFF; } style>Head>
OriginalThe original Book of Jane: https://www.jianshu.com/p/5f18f12cd162Outline1, what is the margin merger? (Folding margin)2, the impact of the outside distance3, the result of folding4, Causes of folding5. The appearance of the situation1, what is the margin merger? (Folding margin)
Recently, I made a project, and it was a long time to struggle with a small CSS problem-the problem of outer margin folding. Today, it is rare to be idle. I have studied this problem and found that I have learned a lot. So I can write a blog article to better remember it!
Outer margin foldThe two or more adjacent margins (m
larger of those.Icon:Another overlap is when an element is contained within another element, and there is overlap between the child element and the parent element, and the overlapping margin is equal to the largest of those:Similarly, if an empty element has no content, its own top and bottom margins overlap.Meaning of margin overlapThe overlap of the margins is only generated between the upper and lower m
Nowadays, the application of negative margin technology is more and more wide, any large site under glimpse will have its shadow. Personally think that the negative margin technology is a learning CSS on the road must be an indispensable topic, many advanced applications and difficult to repair can use negative margin
@charset "Utf-8";/*! * @ Name: Base.css * @ function: 1, reset browser Default style * 2, set generic atomic class*//*prevents users from customizing the effect of background color on Web pages, adding allows users to customize fonts*/HTML{background: White;Color:Black;}/*internal and external margins often make different browser styles behave differently*/body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,bloc
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.