CSS Basics 3--fonts that use CSS to format element content

Source: Internet
Author: User

1. CSS Property Units :

(1) Length units : Includes absolute length units and relative length units

Absolute length units include: cm, MM, in, PT, PC, etc. Absolute length units are best used for print output devices, and absolute length values do not make sense when shown as a frequency screen only.

The relative length units are: px, EM, ex, etc. Relative length refers to the corresponding scaling of the element size relative to the browser's system default value. EM is the size of the font size relative to the text m in the current object. Ex is the size of the font size relative to the text x in the current object. If the font size of the text in the line is not artificially set, the default font size is relative to the browser.

Px,em, conversion of percent: 16px = 1em = 100% 1px = 0.0625em = 6.25%

(2) color Unit :

Expressed as percentages, such as Color:rgb (50%,0,50%);

Set with an integer value between 0-255, such as Color:rgb (128,0,127);

Defines a color using a hexadecimal array, such as color: #e1e1e1;

Defines a color using a simplified hexadecimal number, such as color: #fa1; equivalent to #ffaa11;

In the color of English, such as black, white, etc.

(3) URL Unit : The format is followed by a "url" followed by a parenthesis, in parentheses is the address of the URL.

2. Setting font for element content

(1) Set font name:font-family

Can be set such as Arial, Arial and other fonts. To use secure fonts such as Arial, Verdana, Arial, and so on, you cannot use remote fonts. Multiple fonts can be made at the same time, separated by commas, so the advantage is that if the computer does not have the first font, the browser can use the font specified later.

(2) font Tilt level : Font-style

Property values include Normal/italic/oblique

(3) variant of font : font-variant

Property values include Normal/small-caps. Uppercase letters in the font of elements that use the Small-caps property appear to be smaller than normal uppercase letters.

(4) character weight : font-weight

Property values include normal/bold/bolder/lighter/100/200/300/400/500/600/700/800/900. 400 equivalent to normal,700 equivalent to bold,900 is the heaviest font. Bolder or lighter indicates that the font's character weight is higher or lower than the parent element

(5) Font size : font-size

Property values include:< absolute size > (e.g. 12pt)/< relative size > (e.g. 1.5em)/< percent > (e.g. 150%)

(6) abbreviation for font properties : Font, attribute order is separated by spaces in {Font-style, font-variant, Font-weight, Font-size, font-family}. such as P{font:normal small-caps bold 120% Arial;}

CSS Basics 3--fonts that use CSS to format element content

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.