The block element is characterized by: Always starting on a new line; height, row height, and top and bottom margins can be controlled; the default width is 100% of its container, unless a width is set <div>, <p>, The Inline element has the following characteristics: it is on one line with other elements; the height, the row height, the top and bottom margins cannot be changed; the width is the width of its text or image, which cannot be changed. <Span>, <A>, <label>, <input>, , <strong>, and <em> are examples of inline elements.
Inline and block can control the high row width of an element. The switchover is as follows:
Let an inline element start from a new line; keep the block element and other elements on one line; control the width of the inline element (especially useful for navigation bars); control the height of the inline element; you can set a background color that is the same as the text width for a block element without setting the width.
Features of inline-block elements:
The object is presented as an inline object, but the content of the object is presented as a block object. The Inline object next to it will be presented in the same row and spaces are allowed. (To be precise, the elements applying this feature are rendered as inline objects, and the surrounding elements are kept in the same row, but attributes of the width and height of the plot element can be set) not all browsers support this attribute. Currently, the following browsers are supported: Opera and Safari use display: inline-block for inline elements in IE. ie does not recognize this attribute, but display: inline-block triggers layout in IE, so that the inline element has the table disease of the display: inline-block attribute. From the above analysis, it is not difficult to understand why setting the display: inline-block attribute for block elements in IE cannot achieve the effect of inline-block. At this time, the block element is only triggered by the display: inline-block layout, and it is the row layout, so after the triggering, the block element is still the row layout, instead of submitting an inline object as a block element in opera. How can I implement the display: inline-block effect for block elements in IE?
There are two methods: 1. Use the display: inline-block attribute to trigger the block element, and then define the display: inline, let the block element be presented as an inline object (two displays must be placed in two CSS declarations to achieve the effect, which is a classic bug in IE. If the display: inline-block is defined first, then set the display back to inline or block, and layout will not disappear ). Code As follows (... is the content of other omitted attributes ):
Div {display: inline-block;...} Div {display: inline ;}
2. Set the block element to inline object submission (set the attribute display: inline), and then trigger the layout of the block element (for example, Zoom: 1 ). The Code is as follows: div {display: inline; ZOOM: 1 ;...}