Units in CSS

Source: Internet
Author: User

A unit of relative length:

The relative length is measured by the relationship to other things. A total of 3 relative length units: em,ex,px.

1 "em" is defined as the value of a font-size of a given font, for example, a font-size of one element is 14 pixels, and for that element, 1em is equal to 14 pixels.

Ex refers to the height of the small write x in the font used. If two paragraph text sizes are 24 points, but different fonts are used, their ex values are also different. In the actual problem, take the value of EM, and then take half of the value of ex.

PX is a pixel, which may be more appropriate for the border and positioning of an element than for pixels. If the margin uses EM, it may cause the design to widen or shrink as the text size changes.

Units in 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.