Home > Web Front-end > HTML Tutorial > Common problems in div css_html/css_WEB-ITnose

Common problems in div css_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:31:56
Original
1161 people have browsed it

1. Centering problem
The content in the div is centered by ie by default, and left aligned by ff by default.
The way to center the ff content is to add the code margin:auto;

2. Height problem
There are two horizontal rows of divs arranged, and the above div sets the height (height). If the actual div in the div If the content is greater than the set height, the two divs will overlap in FF; but in IE, the lower div will automatically make room for the upper div. Therefore, in order to avoid overlapping layers, the height must be controlled appropriately, or you may simply not write the height and let it adjust automatically.
Or set: overflow:hidden

3. clear:both;
Take footer as an example. Sometimes if the n-column layout controlled by float is used above, then when browsing with ff, footer It is very possible that he is dishonest and moves around because he is still controlled by float. If you want it to stay at the bottom of the page, write clear: both; in the div of the footer to achieve the effect!

4. Double distance generated by floating Ie
#box{
float:left;
width:100px;
margin:0 0 0 100px; //This situation Below IE will generate a distance of 200px
display:inline; //Ignore floating
}

5. Key explanation: display: block, inline two elements display (display)
display:block; //Can simulate block elements for inline elements

always starts on a new line;
height, line height and top and bottom margins can all be controlled;
width The default is 100% of its container, unless a width is set

,

,

,
,

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template