Two CSS Selectors,properties,and values selector, attribute, value

Source: Internet
Author: User
Css|select

HTML has tags, CSS has selectors. Selectors are named for styles inside and outside styles.

Each selector has attributes in {} it, such as a simple dot image color , font-weight or background-color .

The value is followed by a colon (not equal sign) and the semicolon separates the attribute.

body {font-size: 0.8em;color: navy;}

The above meaning is to body set the font-size font size and for the selector color字体颜色 .

So basically, when it works with HTML pages, the body text color between the tags (the entire window content) is navy the font size is 0.8ems.

length and percentage

CSS has many attribute values to specify units, but some basic units are used on some properties, before this is worth the attribute under them.

em , for example font-size:2em , gives the size of the font, so 2em is twice times the size of the actual font.

px , for example, font-size:12px is a unit of pixel pixels.

PT , for example, font-size:12px is a unit of points pounds.

% , such as font-size:80% percent

Other units include PCs(12-point Western type),cm(cm),mm(mm) and in (inches)

When the value is zero, the unit is not needed, for example: border:0 there is no border.

Web pages are not static, absolute media. This means that internal energy is scaled and distorted, and users should be allowed to adjust their preferred ways, including font size and screen size.

Because of this, it is recommended to use "em" and "%" on the font-size (width and height), compared to the PX can not be in most browsers to change the size, so use less, you can use in the size of the border.







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.