CSS tutorial selection of character attributes and values
Source: Internet
Author: User
HTML has tags, and CSS has selector ). The selector is the name assigned to the internal or external style sheet. In the CSS beginner's guide, we focus on the HTML selector, that is, the HTML tag, which is used to change the style of a specified tag.
Each selector has properties in braces {}, including words in the form of color, font-weighth, or background-color.
The value is enclosed by a half-width pair of quotation marks (quotation marks) followed by a half-width pair of semicolons.
Body {font-size: 0.8em; color: navy ;}
As shown above, this assigns values to the font-size and color attributes in the body selector.
Basically, if this is applied to HTML documents, the text between the body labels (the content of the entire window) will be 0.8em in size and be displayed as dark blue.
Length and percentage
CSS has many proprietary attribute units, and many common units that can be used in a large number of attributes. They deserve your familiarity before you continue learning.
Em (such as font-size: 2em) is a unit of roughly the same height as a single character.
Px (font-size: 12px) is the unit of a pixel.
Pt (font-size: 12pt) is a pound unit.
% (Font-size: 80%) is ...... Unit, and so on. Oh, it's a percentage.
Other units include pc, cm, mm, and in ).
When a value is 0, you do not have to declare a unit for it. For example, if you do not want a boundary, you can set it as follows: border: 0.
Note:
Webpages are not static and absolute media. This means that the web page is flexible and users are allowed to browse the web page as they like, including the font size and screen size.
Therefore, the best unit for assigning values to the font-size attribute is em or %, while px will cause the text to be unscalable in most browsers, it will also lead to poor and boring text.
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.