CSS units and values

Source: Internet
Author: User
Tags color representation

CSS requires units to measure. In the case of integers, decimals and percentages, there is a limit to the number of positive and negative conditions that are supported in many cases. A percentage is basically a property value relative to itself, or to the parent or ancestor element.

Color

The color representation is divided into: named Color, RGB, 16 binary, HSL. CSS2 has 16 colors, css2.1 has 17 species, and CSS3 has 140 species. These 140 colors are based on X11 RGBB standard values, support is good, but the problem is still not enough delicate.

RGB: The previous display is based on the CRT, relying on the energy of the electron gun to control the color. The principle of light is different from the normal reflection wavelength of the human eye, but direct light to the eye, so the RGB (0,0,0) is black, RGB (255,255,255) is white. Basically divided into: integer ternary group, percentage ternary group. Integer range is 0~255, percent is)-100% and decimal is supported. The problem is that if an out-of-bounds situation occurs, it will be cropped to the nearest value. such as: 266 becomes 255,-23 conversion to 0. percentages and integers are converted by a percentage multiplied by 255 and converted to the nearest integer.

Hexadecimal: This is the conversion of an RGB integer, which is not the same as an integer. Convert everyone to the corresponding hexadecimal number on the line.

Web-Safe color: 256-color display the specific color that the system takes to prevent color jitter. Percentages are: 0%, or multiples of 20%, integers are 0, or multiples of 51. Hexadecimal is: The combination of the more than one CC ff.

Length

length units are: absolute length units and relative length units. Absolute length units are more relevant to the printing and printing industry, including: in mm cm pt (1/72 in) PCs (1/6 in) and so on.

Relative length units: Em, ex, PX. Related to resolution, and also to elements. The font-size of EM relative to an element may be itself, possibly the parent element. Ex is the lowercase x height of the font, usually 0.5em. PX is related to resolution.

Url

Just note that the relative URL is for its own document, not the location of the HTML. Of course, relative URLs require the same domain.

Key words

The inherit is primarily the specified inherited value that can be displayed.

CSS units and values

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.