CSS Learning V-unit and value

Source: Internet
Author: User

a, "1, Color Expression method summary: 1, English command color in front of a few sections of the often used is this setting method: p{color:red;} 2. RGB color This is consistent with the RGB color in Photoshop and is color-matched by the ratio of R (red), G (green), B (blue) three Colors. P{color:rgb (133,45,200);} The value of each item can be an integer between 0~255, or it can be a percentage of 0%~100%. Such as: P{color:rgb (20%,33%,25%);} 3, hex Color This color setting method is now more commonly used method, and its principle is actually RGB settings, but its value of each item from 0-255 to hexadecimal 00-ff. P{color: #00ffff;} "2, unit and value 1, pixel pixel why is relative unit?" Because pixels refer to dots on the display (the CSS specification assumes "90 pixels = 1 inches"). The reality is that the browser uses the actual pixel value of the display, and most designers now tend to use pixels (px) as Units. 2, em is the font-size value of this element given the font, if the element font-size is 14px, then 1em = 14px; If the font-size is 18px, then 1em = 18px. The following code: p{font-size:12px;text-indent:2em;} The code above is the ability to indent the first line of a paragraph by 24px (that is, The distance of two font sizes). Here's a special case: but when Font-size is set to em, the criteria for calculation are based on the font-size of the parent element of P. The following code:html:<p> the example of this <span> example </span>. </p>css:p{font-size:14px}span{font-size:0.8em;} As a result, the font "example" font size in span is 11.2px (0.8 = 11.2px). 3, percent p{font-size:12px;line-height:130%} Set the line height (line Spacing) to the 130% of the font (* 1.3 = 15.6px).

CSS Learning V-unit and value

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.