CSS Authoritative guide reading notes values and units

Source: Internet
Author: User

Equivalent color table

What do you mean Web-safe color

The so-called "web-safe" color refers to the color that always avoids dithering on a 256-color computer system.

Web-safe colors can be represented as multiples of RGB values of 20% and 51 (the corresponding hexadecimal value is 33).

If you use RGB percentages, make all 3 components either 0% or a number that can be 20 integers

Similarly, if you are using an RGB value of the 0~255 range, the values of each component are either 0 or the number of integers that can be 51.

If hexadecimal notation is used, a ternary group with values 00, 33, 66, 99, CC, and FF is the web-safe color.

Absolute length Unit

There are 5 units of absolute length. Inches (in), centimeters (cm), millimeters (mm), Dots (PT), picas (PC)

Inches: Units on American rulers

CM: the unit on a ruler all over the world. 1in=2.54cm 1cm=0.394in

MM: 10mm=1cm 1in=25.4mm 1mm=0.0394in

Point: Point is a standard printing unit of measure 1 inches is 72 points (for example, if the first letter of the text is set to 12 points, it is equivalent to 1 inches of 1/6 high)

Picas: 1 Card is equivalent to 12 points, 6 cards equals 1 inches

Relative length Units

Relative units: According to the relationship with other things to measure, a total of 3 relative length units: em,ex,px

where EM represents Em-height, ex represents x-height, px represents pixels.

An EM is defined as a font-size value for a given font. (For example: if the font-size of an element is 14 pixels, then 1em is equal to 14 pixels for that element)

When you set the font size, the value of EM changes relative to the font size of the parent element.

Ex refers to the height of the small write x in the font used, but this is only a theory, the general 1ex=0.5em

The pixel is relative length because the small color box on the monitor is a pixel. At the time of printing, 1px may use 96ppi reference pixels.

EM is the most flexible because it scales with font size, so elements and element operations are more consistent.

A fragmented but useful CSS tip

1. In CSS, relative URLs are relative to the style sheet itself, not to HTML documents that use the style sheet

2, using Background:url (picture path), notice there is no space between the URL and the opening parenthesis, if there are spaces, the entire declaration will be invalid, so that it is ignored.

3. Inherit is a keyword common to all attributes, so that the value of one property is the same as the value of its parent element

<Head>    <styletype= "Text/css">#toolbar{background:Blue;Color: White;        }
#toolbar a{Color:Inherit; /*Only add this sentence after the color of a link is white otherwise the default browser set the blue*/ } </style></Head><Body> <DivID= "Toolbar"> <ahref= "' #">One</a>| <ahref="#">Both</a>| <ahref="#">Trhee</a> </Div></Body>
CSS2 units

1, Angle values: degrees (deg), gradients (grad), radians (RAD) In any event, these values will be interpreted as the number of degrees in the 0~360 range. such as: -90deg=270deg

2, Time value: milliseconds (ms), seconds (s)

3. Frequency value: Label Hz or MHz after Hertz (Hz), megabits (MHz) value is case insensitive

CSS Authoritative guide reading notes values and units

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.