CSS memo, css memo

Source: Internet
Author: User

CSS memo, css memo

CSS rule illustration

Different colors
p { color: #ff0000; }p { color: rgb(255,0,0); }p { color: rgb(100%,0%,0%); }

When the RGB percentage is used, the percentage symbol must be written even if the value is 0.

Value quotation marks

If the value is a number of words, enclose the value with quotation marks.

p {font-family: "sans serif";}
Attribute Selector

It is specified only! When DOCTYPE is used, IE7 and IE8 support attribute selectors. Attribute selection is not supported in IE6 and earlier versions.

[Attribute]
Used to select elements with specified attributes.

[Attribute=Value]
Used to select elements with specified attributes and values.

[Attribute~ =Value]
Used to select elements whose attribute values contain the specified vocabulary. Applies to attribute values separated by spaces. Title = 'Hello world'

[Attribute| =Value]
Used to select an element with an attribute value starting with a specified value. The value must be the entire word. Applies to the attribute values separated. Lan = 'zh-cn'

[Attribute^ =Value]
Matches each element whose attribute value starts with a specified value.

[Attribute$ =Value]
Matches each element whose attribute values end with a specified value.

[Attribute* =Value]
The matching property value contains each element of the specified value.

Selector priority

The CSS style selector has four levels: a, B, c, and d. The priority of the CSS selector can be determined based on these four levels.

Calculate the values of a, B, c, and d for priority ranking.

Font family
  • Serif font
  • Sans-serif font
  • Monospace font
  • Cursive font
  • Fantasy font
Link Style
  • A: link-common, unaccessed link
  • A: visited-the user's accessed Link
  • A: hover-The mouse pointer is above the link
  • A: active-time when the link is clicked

A: hover must be located after a: link and a: visited, and a: active must be located after a: hover.

Percentage setting for the value of the internal and external margins

Padding and margin use the percentage setting to calculate the percentage of width relative to the parent element.

Related Article

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.