The units in the CSS

Source: Internet
Author: User

CSS presets 16 colors and 16 colors of the derivative color, these 16 colors are recommended by the CSS specification, and some mainstream browsers are able to identify, as shown in the following table:

Hexadecimal colors are the most common way to define them. Its basic format is #rrggbb,r, G, and B represent red, green and blue respectively. You can also set the color with RGB (R,G,B), the parameter is represented by the decimal number of the 0~255

To ensure that the page elements can be fully displayed in the browser in a reasonable layout, you need to set the spacing of each element and the border size of the elements themselves, which are inseparable from the use of length units.
In CSS, the unit of length is divided into absolute units and relative units.
The CSS mainly consists of the following 5 absolute units:

Relative units are the unit values that you need to refer to other page elements when measuring. The actual distances measured using relative units may change as these unit values change.
The CSS provides 3 of the relative units:

  • Em for a given font font-size value, for example, an element font size of 12pt, then 1em is 12pt;
  • Ex refers to the height of the lowercase letter x in the font used, such as the small and medium letter x of time New Roman lowercase letters x,arial. In practical applications, the value of ex is equal to the value of EM divided by 2. This unit is difficult to calculate, so it is not often used
  • PX is the unit of pixel values, in CSS, 90px=1in. However, if the operating system or browser support is different, the display of pixel values is uncertain, so the user can use the pixel values appropriately.

The units in the CSS

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.