Learn more about CSS attribute units

Source: Internet
Author: User
Because style table items are composed of attributes and their values, it is necessary to understand the various units of the attribute values. In CSS, different units are different from those in HTML.
1. Length unit
Unit Type description
Cm
Width of m letters in em EMS current font
The x letter height in the current font of the ex exs.
In inch
Mm
Pc Picas 1 pica = 12
Pt point 1 = 1/72 inch
Pixel display unit
Note: not all browsers support the above length units. For example, IE3.x does not support em and ex. NS4.0 does not support pc units.
In the above unit, you must specify em and ex.
The height represented by "em" is the height of the capital letter "M" (or "H"). If the current font is 12, then em is 12. Generally, the default font of the browser is 12. If the default font size is changed, the em value is adjusted accordingly.
For example, if the font size in the <H1> mark is set to 1.5em, the browser will execute the following process during HTML compilation:
(1) Read the default font size value, such as number 12;
(2) read the relative definition value 1.5em;
(3) display the 18 font (12pt X 1.5 = 18pt ).
It can be seen that the em unit is defined based on the default value of the user's browser, so that both the web designer and the viewer have control over the font size-the designer can specify the need to expand (or contract) the actual display size is selected by the user.
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.