CSS tutorial 2. CSS Selectors, Properties,

Source: Internet
Author: User
CSS tutorial 2. CSS Selectors, Properties, and Values selector, attributes, and Values [translate Htmldog]
HTML has tags and CSS has selectors. The selector is used to name internal and external styles.
Each selector has attributes in {}, such as simple points like color, font-weight or background-color.
Values are separated by semicolons after colons (not equal signs.
Body {
Font-size: 0.8em;
Color: navy;
}
The above indicates setting the font-size font size and color font color for the body selector.
So basically, when it works with an HTML page, the text color between the body tag (content in the entire window) is navy and the font size is 0.8ems.
Length and percentage
There are many attribute values in CSS to specify units, but some basic units are used in some attributes. Before that, they are worth attributes.
Em: for example, font-size: 2em gives the font size, so 2em is twice the actual font size.
Px, for example, font-size: 12px is the unit of pixel.
Pt. For example, font-size: 12px is the unit of the points pound.
% For example, font-size: 80% is a percentage.
Other units include pc (12-point Spanish active text), cm (cm), mm (mm), and in (inches)
When the value is zero, no unit is required. For example, border: 0 indicates no border.
Webpages are not static and absolute media. This means that internal scaling and deformation can be performed, and users should be allowed to adjust their preferred methods, including font size and screen size.
In this case, we recommend that you use "em" and "%" on font-size (width and height). In contrast, px cannot be changed in most browsers, so use less, it can be used on the border size.

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.