Units in web development to solve problems

Source: Internet
Author: User

What are the units in Web development?

Pixel (px)

Depending on the resolution of the monitor to determine the length, the unit is used more in Web applications.

Points (PT)

Determines the length based on the font size defined by the Windows system.

Inches (in), centimeters (cm), and millimeters (mm)

Depending on the actual size of the display, the length is determined, and such units do not change with the display resolution.

12pt Word (PC)

That is, the Windows system-defined 12 font size is in units (1pc=12pt).

The number entered before the unit represents a multiple of the font size, such as {font-size:2pc;} Indicates that the text size is 24pt.

The above units are fixed values, changing the browser text size does not change the text of these units to be applied.

Font height (EM)

Represents the size of the current text.

{font-size:2em} refers to twice times the original text size.

Height of font x (ex)

Represents the height of the current letter "X".

%

is the size defined as a percentage of the current text.

{font-size:200%} refers to twice times the original text size.

What is the difference between PX and EM, and what is the specific case to use?

PX is suitable for non-responsive layouts, that is, the size is fixed, even if the browser is reduced, and the EM equivalent of multiple relationships, suitable for responsive layout, that is, the page will be the size of the browser to change the layout, such as the font will become larger or smaller.

Units in web development to solve problems

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.