Home  >  Article  >  Web Front-end  >  Unit in CSS_html/css_WEB-ITnose

Unit in CSS_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:43:101049browse

CSS presets 16 colors and derivatives of 16 colors. These 16 colors are recommended by CSS specifications and can be recognized by some mainstream browsers, as shown in the following table:

Hexadecimal color is the most common way to define it. Its basic format is #RRGGBB, where R, G, and B represent red, green, and blue respectively. You can also use RGB (R, G, B) to set the color. The parameters are represented by decimal numbers from 0 to 255

In order to ensure that the page elements can be fully displayed in the browser according to a reasonable layout, you need to set the spacing of each element. As well as the border size of the element itself, etc., these attribute values ​​​​are inseparable from the use of length units.
In CSS, length units are divided into absolute units and relative units.
CSS mainly includes the following 5 absolute units:

Relative units refer to the unit values ​​of other page elements that need to be referenced when measuring. Actual distances measured using relative units may change as the values ​​of these units change.
CSS provides 3 relative units:

  • em is used for the font-size value of a given font. For example, if the font size of an element is 12pt, then 1em is 12pt;
  • ex Refers to the height of the lowercase letter x in the font used, such as the lowercase letter x in Time New Roman, and the lowercase letter x in Arial. In practical applications, the value of ex is equal to the value of em divided by 2. Calculating this unit is troublesome, so it is not often used.
  • Px is the unit of pixel value. In CSS, 90px=1in. However, if the operating system or browser support is different, the display of pixel values ​​is also uncertain, so users can use the pixel values ​​appropriately.
  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn