One of the most important tips for processing HTML elements is to understand how they work. Most pages can be combined with a little bit of tags, and you can style each selected tag. The default visual style elements of the browser are composed of the changed font style, border, padding, and important and display types.
The most basic display types are inline, block, and clear none. They can be used to assign the display attribute to the values of inline, block, and none.
As defined in its own semantics, inline displays elements that flow with rows. Both the anchor and stressed elements are traditional inline elements.
Block causes the element to have a broken line before and after it. The title and paragraph elements are examples of traditional block elements.
None. Well, it sounds useless to not display this element, but it is useful for ease of use (see affinity connections), style sheet change, or advanced flip effects.
For example, the default original version of the site is used to adapt to the design by manipulating some traditional inner and block elements.
H1 {
Display: inline;
Font-size: 2em;
}
# Header p {
Display: inline;
Font-size: 0.9em;
Padding-left: 2em;
}
This allows the title and label lines of "htmldog.com" to be side by side, instead of being one to the other, to maintain optimal ease of use.
# Navigation, # seeAlso, # comments, # standards {
Display: none;
}
The above code is used in print styles to "close" these elements. For example, for a single page navigation, it is usually not necessary.
Note:
The difference between display: none and visibility: hidden is that display: none makes the element completely a dead ball, but visibility:
Although the hidden element does not exist in the content, it retains the stream position of this element. For example, if the second end of the third segment is set to display: none, the first segment will directly reach the third segment, and set it to visibility: hidden, this section will have an interval.
Table
Perhaps the best way to understand the display attribute values related to tables is to care about HTML tables. Table is initialized. You can use tr and td to simulate the values of table-row and table-cell respectively.
The display property goes further, the values of table-column, table-row-group, table-column-group, table-header-group, table-footer-group, and table-caption are all self-described. The obvious advantage of these values is that you can use columns to construct tables instead of biased rows.
Finally, inline-table sets the rows before and after the table.
Note:
If you lose control of CSS tables, it may seriously damage your webpage's affinity (ease of use ). HTML should be used to convey content, so if you have table format data, you should use HTML tables to arrange them. A css table can only be used for data seasoning. It is completely unreadable without CSS. Very bad. Don't take Michael Jackson's path.
Other display types
List-item is also self-described. It is generally displayed in the form of a list and used on HTML elements except li. To display the information correctly, the display type should be nested in ul or ol elements.
Run-in enables inline or block display of elements, depending on the display attribute of its parent element. It cannot work in both IE and Mozilla-based browsers.
Campact also enables element inline or block display, which also depends on the context. It cannot work very well either.
Marker defines the value of the content attribute together with the: before AND: after pseudo elements. The automatic value of the content attribute is already marker, so this is only useful for overwriting the display attribute of the previous content.