Cascading Style Sheets: the definitive guide, 2nd edition is a thorough review of all aspects of css2.1 and a comprehensive guide to CSS implementation. the book already des new content on positioning, lists and generated content, table layout, user interface, paged media, and more. it has es in detail each individual CSS property and how it interacts with other properties, and shows how to avoid common mistakes in interpretation. w3C CSS home page: http://www.w3.org/Style/CSS/
1. CSS and document
1.1 ElementsElements in HTML are easily identified, such as P, table, span, A, and Div. Elements in XML are defined by DTD or XML schema. Each element represents its representation. Each element in CSS generates a box, which contains the content of the element.
1.1.1 element types: replaced and nonreplaced elements, block-level and inline-level elements
Replaced Elements: The content of an element can be replaced by content not directly represented by a document. The IMG in XHTML is typical. It can be replaced by image files outside the document. The input element can also be replaced by radio buttons, checkbox, and text input boxes based on its type. Replaced elements also generates a box during display.
Nonreplaced Elements: The majority of HTML and XHTML elements are nonreplaced. That is to say, the content of these elements is expressed by the user agent (usually the browser) in the box generated by the element. (Box indicates a region corresponding to an element on the page ?). For example <Span> Hi There </span> is nonreplaced. Text hi here will be performed by the user agent .Block-level element block element: generates an element box that fills in the content area of its parent element and has no other elements on either side. That is to say, by default, each block-level is a single row. For example, P and Div. List items is a special block element. To unify the behavior with other block elements, generate a symbol for the unordered lists, such as bullet; generate a number for the ordered lists. Add a symbol or number to the element box. In addition to the symbolic representation, other features are the same as those of other block elements. Inline-level element inline element: generates an element box, which contains a line of text and is not a separate line. A typical example is the element in XHTML, such as strong and em. Because inline elements do not interrupt the display before and after them, if they appear in other elements, they do not interrupt the display of other elements. Note: block elements in XHTML and HTML cannot be inherited from inline elements, but there is no similar rule in CSS. There is no restriction on element nesting.
Http://www.cfan.com.cn/school/pro/html/2007-01-13/1168655000d36593.shtmlBlock elements are generally the container elements of other elements. Block elements generally start from a new line and can accommodate inline elements and other block elements, the common block element is the section tag 'p. The "form" block element is special. It can only accommodate other block elements. If no CSS function is available, the block elements are arranged in the order of each row. With CSS, we can change the default layout of HTML and place block elements in the desired position. Instead of just starting another line. It should be noted that table labels are also a type of block elements. Table based layout and CSS based layout are from average users (excluding persons with visual impairment and blind people) the two la s have no difference except the page loading speed. However, if a common user inadvertently clicks the page source code button, the difference between the two is very large. The CSS layout page source code, designed based on a good refactoring concept, should at least allow common users without web development experience to quickly read and understand the content. From this perspective, CSS layout code should have a better aesthetic experience. You can think of the block container element Div as a box, or it is easier to understand if you have played the clipboard. First, we cut down the necessary articles from various newspapers and magazines. Each piece of cut is a block. Then we pasted the paper block to a blank new paper with glue based on our typographical intent. This forms your own unique digest Express. As an extension of technology, webpage layout design follows the same pattern .. Inline Element(Inline element)It is generally a basic element based on the semantic level (semantic. Inline elements can only contain text or other inline elements. Common inline elements are "". Both block element and inline element are concepts in the HTML specification. The basic difference between block elements and inline elements is that block elements generally start from a new line. After CSS control is added, the differences between block elements and inline elements will not be the same. For example, we can add the inline element cite to the display: block attribute so that it also has attributes starting from the new line each time. Variable ElementThe basic concept is that it needs to determine whether the element is a block element or an inline element based on the context relationship. The variable element still belongs to the above two element categories. Once the context relation determines its category, it must follow the block element or Inline element rule restrictions. For rough element classification, see the full text. PS: for the Chinese name of inline elements, there are multiple inline elements, embedded elements, in-row elements, and straight-forward elements. Basically, there is no unified translation. What do you call love. When we mention inline elements, we will think of a display attribute: Display: inline; which can fix the famous IE Double Floating boundary. Block Element) * Address-address * BLOCKQUOTE-block reference * Center-align Blocks * Dir-directory list * Div-common block-level labels are easy, and they are also the main labels of CSS layout. * Dl-definition list * Fieldset-Form Control Group * Form-interactive form * H1-large title * H2-subtitle * H3-Level 3 title * H4-4 level title * H5-Level 5 Title * H6-6 titles * HR-horizontal Separator * Isindex-input prompt * Menu-Menu list * Optional content of noframes-frames. (content in this block is displayed in browsers that do not support frame. * NoScript-) Optional script content (this content is displayed in browsers that do not support scripts) * Ol-sorting form * P-paragraph * Pre-format text * Table-table * Ul-non-sorted list Inline Element) * A-anchor * Abbr-abbreviation * Acronym-First word * B-bold (not recommended) * BDO-bidi override * Big-large font * Br-line feed * CITE-Reference * Code-computer code (required when source code is referenced) * Dfn-define a field * Em-emphasis * Font-font setting (not recommended) * I-italic * IMG-Image * Input-input box * KBD-defines the keyboard text * Label-Table label * Q-short reference * S-hyphen (not recommended) * Samp-Defines sample computer code * Select-select a project * Small-small font text * Span-commonly used inline containers that define text blocks * Strike-dashes * Strong-highlighted in bold * Sub-subscript * Sup-superscript * Textarea-multi-line text input box * Tt-telex text |
* U-underline * Var-define variablesVariable Element The variable element determines whether the element is a block element or an inline element based on the context. * Applet-Java Applet * Button-button * Del-delete text * IFRAME-inline Frame * Ins-inserted text * Map-image block (MAP) * Object-object * Script-client script |
Example:
<body>
<p>This is a paragraph with <em>an inline element</em> within it.</p>
</body>
In the preceding example, there are two block elements, P and body, and an inline element em. In XHTML, EM can inherit from P, but not vice versa. Inline elements in XHTML can be inherited from block elements, but not vice versa. There is no such rule in CSS. CSS can change the structure of the above example. P {display: inline;} em {display: block;} insert block box in inline box. Effect: Changing the display role of an element is useful in XHTML. XML documents do not have any inherited display roles, so it is very important to define them through CSS.
<book>
<maintitle>Cascading Style Sheets: The Definitive Guide</maintitle>
<subtitle>Second Edition</subtitle>
<author>Eric A. Meyer</author>
<publisher>O'Reilly and Associates</publisher>
<pubdate>2004</pubdate>
<isbn>blahblahblah</isbn>
</book>
<book>
<maintitle>CSS2 Pocket Reference</maintitle>
<author>Eric A. Meyer</author>
<publisher>O'Reilly and Associates</publisher>
<pubdate>2004</pubdate>
<isbn>blahblahblah</isbn>
</book>
Default display:
Use CSS to define the display level:
book, maintitle, subtitle, author, isbn {display: block;}
publisher, pubdate {display: inline;}
Display now:
Can affect the display role
Display roles
Is
CSS
Important reasons for high usefulness in multiple situations.