Css authoritative guide-notes and css authoritative guide

Source: Internet
Author: User

Css authoritative guide-notes and css authoritative guide

Chapter 4 css and documentation

1. element: replacement element (img input), non-replacement element (most span ).

2, link: rel (Representative relation: stylesheet, candidate style sheet: alternate stylesheet); type (text/css); media :( all (all representations of media, screen, print ), title (used with candidates ).

3, @ import url(sheet1.css) must be used in the style before other css rules.

4. Backward accessibility: <style> <! -- Style --> </style>. In this way, the style is ignored by older browsers, and the css browser can read the style sheet normally.

5. css comments :/**/.

Chapter 4 Selector

1. When declaring a group, you must use a semicolon at the end of each declaration.

2, p. warming. help {background: red;} Only matches the p elements whose class contains warming and help. If p contains warming and other elements, it cannot match.

3. In fact, the browser does not check the uniqueness of the id in html, but this makes dom writing more difficult.

4. Attribute selector: h1 [class] {...}

H1 [class = ''] {...} exactly matches

H1 [class ~ = ''] {...} Partially match all the elements in [class ^ = ''] starting with [class $ =''] ending with [class * = '']

* [Lang | = 'en'] for a specific attribute selector, all elements whose lang attribute is equal to en or starting with en-are selected.

5. Select child elements: h1> strong. Select adjacent sibling elements h1 + p (h1 and p have the same parent element, and finally select p ).

6. link pseudo-class: unaccessed link: link, accessed link: visited (both static), equivalent to <body link = ''vlink = ''>.

Dynamic pseudo class: focus, mouse stop: hover, activation: active. (Dynamic pseudo classes can be used for any element)

We recommend that you use the pseudo-class sequence link-visited-focus-hover-active.

When selecting the first child element (: first-child), it is easy to misunderstand that it is the first child element (in the following example, the element as the first child element includes the first p, the first li, strong, and em ).

 1 <div> 2     <p>helooo</p> 3     <ul> 4         <li>111</li> 5         <li><strong>222</strong></li> 6     </ul> 7     <p> 8         <em>333</em> 9     </p>10 </div>

Select (: lang () based on the language, such as *: lang (fr) {color: red;}. This turns all French elements into red.

Pseudo element selector: first letter: first-letter. The user agent dynamically forms the hypothetical element <p: first-letter>;

Line 1: first-line;

Before and after: before: after.

Chapter 4 Structure and cascade

1. In fact, all style conflicts are solved by cascade.

Special Characteristics of selector: id selector (,); Class Attribute pseudo class (,); each element and pseudo element (,); wildcard selector, 0, 0); inline style (1, 0, 0 ).

Importance :! Important is placed before the end semicolon of the Declaration.

2. Exceptions: the background style applied to the body element can be passed to the html element (html is the root element of the document) and its canvas can be defined accordingly.

Most of the Box Model attributes cannot be inherited (including the background border with the inside margin of the outer margin). The inherited value has no special characteristics, and the 0 special is stronger than the no special characteristics.

3. The weight of the statement ranges from large to small: the reader's important statement> the Creator's normal Statement> the reader's normal Statement> the User Agent statement.

By linking pseudo classes together, you can alleviate the problems caused by special characteristics and order.

Chapter 3 values and units

1. Functional rgb color: rgb (color), which is expressed by a percentage (0%-100%) or an integer triple (0-255.

Hexadecimal rgb color: you can set a color by concatenating three hexadecimal numbers between 00-FF.

Web Security Color: A 256-color computer system can always avoid jitters. The rgb value is a multiple of 20% and 51, and 0% 0 is also the hexadecimal value, 99, cc, ff.

2, absolute length unit: in cm mm pt pc.

Unit of relative length: 1 em is defined as the font-size value of a given font (the value varies with the element). ex indicates the height of x in the font used, px is ideal for measuring the image size (a small grid is 1 pixel ).

3. a {color: inherit} allows the link to use the inherited color value instead of the default style of the user agent.

4. degrees (deg), gradients (grad), and radians (rad) are allowed.

Time: ms, s. Negative values are not allowed.

Frequency value: Hz, MHz. Negative values are not allowed.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.