是块元素的例子。 display:inline就是将元素显示为行内元素. inline元素的特点是: 和其他元素都在一行上; 高,行高及顶和底边距不可改变; 宽度就是它的文字或图片的宽度,不可改变。 , , , , , 和是inline元素的例子。
例子:
无标题文档
6. Problems with IE and FF width and height min -width is very convenient CSS command, which can specify that the minimum element cannot be less than a certain width, so as to ensure that the layout is always correct. The overall narrowest is 770px and the widest is 1024px. In other words, if the window is smaller than 770xp, the bottom scroll bar will appear. If the window is larger than 1024px, the screen will be automatically centered. IE does not recognize the definition of min-, but in fact it treats normal width and height as if there is min. In this way, if you only use width and height, these two values will not change in a normal browser. If you only use min-width and min-height, the width and height are not set at all under IE. CSS is designed like this: #container{ min-width: 600px; width:expression(document.body.clientWidth < 600? "600px": "auto" ); }
The first min-width is normal; but the width in the second line uses Javascrīpt, which is only recognized by IE, which will also make your HTML document less formal. It actually implements the minimum width through Javascript's judgment.
The same method can also be used to achieve the maximum width for IE: #container { min-width: 600px; max-width: 1200px; width:expression (document.body.clientWidth < 600? "600px" : document.body.clientWidth > 1200? ”1200px“ : ”auto”; }
7. FF: Supported! important, IE ignores it, can be used with !important (for example: height:30px!important; height:26px;) to specially set the style for FF The vertical centering problem of div: vertical-align:middle; Increase the line spacing Line-height: 200px as high as the entire DIV; then insert text and it will be vertically centered. The disadvantage is that the content must not be wrapped cursor: pointer can display the cursor finger shape in IE FF at the same time, hand can only be used in IE FF: To add borders and background colors to links, you need to set display: block and float: left to ensure no line breaks (the background image needs to be set to float: left). Referring to menubar, setting the height of a and menubar is to avoid dislocation of the bottom edge. , if height is not set, you can insert a space in the menubar The BOX model interpretation in FF and IE is inconsistent, resulting in a 2px difference. Solution: div{margin:30px!important;margin:28px;}
Note that the order of these two margins must not be reversed. According to Ajie, the !important attribute is not recognized by IE, but other browsers can, so it is actually interpreted like this under IE:
<.>div css xhtml xml Example Source Code Example Source Code [www.52css.com] div{maring:30px;margin:28px}
If you repeat the definition, it will be executed according to the last one, so it is not possible Just write margin:XXpx!important;
In Firefox/Mozilla browsers, the actual width of the object = (margin-left) (border-left-width) (padding- left) width (padding-right) (border-right-width) (margin-right); and in IE/Opera browsers, the actual width of the object = (margin-left) width (margin-right).