"CSS The Definitive Guide" book Beas Overview - Chapter CSS and documentation

Preface: CSS that is Cascading Style Sheets primarily affect the performance of one or a set of documents, no documents, CSS useless.

A, web fading

Fully structured text is too old-fashioned, too common, although there are N reason to require the use of structured markup, but HTML already reached today.

Two, CSS do savior

Rich style, ease of use, use patterns, stacked on multiple pages, reduce file size, prepare for the future, so CSS has a richer appearance, will be able to create and modify the appearance of the entire document in one place, you can linked style sheet to all the documents on the site, but also provides conflict rules, which are collectively referred to as stacked. At the same time you can reduce file size, to prepare for the future.

Third, the elements

When the basic elements of document structure, can be divided into the following categories:

1 "with the elements and non-replaced elements.

Means for replacing the element part of the contents not directly replace elements represented by the document content. Such as img elements. input element and so on.

Xhtml and most HTML elements are non-replaced elements, such as span, h1 ~ h6 title tag, table cell, almost all the elements in the list are non Xhtml and replaced elements.

2 "display element role

Block elements and inline elements.

Generating a block-level element box element, is populated region of the parent element content, after generating "Separator" and before the element block. Such as p, div element, the element may alternatively be a block-level element, but is usually not.

Row element

Inline elements generated within the text box element line, without interrupting the line of text, such as a label, also a strong and em.

Difference: in HTML and XHTML, block-level elements within the element itself can not be inherited, can not be nested within the row-level element. But in CSS, in line with the role of the display of nested there are no restrictions. I.e., the element row can be inherited block elements, the block elements may comprise inline elements, not vice versa.

Fourth, the combination of CSS and XHTML.

That is how to refer css, methods are:

1 "link mark

I.e., <link rel = "stylesheet" type = "text / css" href = "sheet1.css" media = "all"> using an external style sheet, it is noted that the link to be placed in the head element, the external style sheet You can not contain any XHTML or other markup language, only css style rules and comments.

Attributes

rel represents the relationship relation, relationship stylesheet, type is always set to text / css, href = "external style sheet position" represents the value of the media is to be applied to all media in all its manifestations. aural for voice synthesizer, screen reader, sound performance and other documents, and so on.

If a document to be associated with multiple style sheets, you need to load multiple link tags.

Candidate stylesheet

The value of the rel set to alternate stylesheet, you can for users to choose.

2 "style elements appear in a separate document

<Style type = "text / css> ... </ script> Documents to be nested style sheets or style sheets.

3 "@import command

@import url (sheet2.css) for loading an external style sheet. @import appear in the style containers, but also into other CSS rules before, or simply does not work.

link and @import difference:

Each instruction @import styles will load and use.

4 "inline style

<P style = "color: gray";>, in addition to the external tag appears body, head and the like such as how title, style attributes can be associated with any other tag in HTML.

5 "CSS comment

Single-line comments, multiline comments, CSS comments can not be nested.

Guess you like

Origin www.cnblogs.com/hanggedege/p/11669345.html