Comparison of measurement units for web design

Source: Internet
Author: User
Tags comparison

The size of a page element in a Web page is decorated in addition to the numeric size, and is the choice of units of measure. What are the different units of measurement? First of all, we understand the various types of web design units and instructions. Original link

Pixels (px)

According to the resolution of the monitor to determine the length, in the Web application more use of the unit;

Points (PT)

Determines the length according to the font size defined by the Windows system;

Inches (in), CM (cm) and mm (mm)

Determines the length according to the actual size of the display. Such units do not change with the resolution of the display;

12pt Word (PC)

That is, the Windows system-defined 12 font size is unit (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 affect the use of these units of the text changes.

Font height (EM)

Represents the dimensions of the current text. such as {font-size:2em} refers to the text size is twice times the original;

Height of font x (ex)

Represents the height of the current letter "X";

%

is to define the dimensions as a percentage of the current text. such as {font-size:200%} refers to the text size is twice times the original;

Viewing comparisons in Web pages for each unit of measure in a Web page <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<style type= "Text/css" >
<!--
Body {
Font-family:verdana, Arial, Helvetica, Sans-serif;
}
p {
Background-color: #EFEFEF;
margin:5px;
padding:4px;
}
. px12 {
font-size:12px;
}
. px14 {
font-size:14px;
}
. pt12 {
font-size:12pt;
}
. pt14 {
font-size:14pt;
}
. in1 {
font-size:1in;
}
. PC1 {
font-size:1pc;
}
. PC2 {
font-size:2pc;
}
. em2 {
Font-size:2em;
}
. ex1 {
Font-size:1ex;
}
. ex2 {
Font-size:2ex;
}
. ex4 {
Font-size:4ex;
}
. per2 {
font-size:200%;
}
-->
</style>
<body>
Normal font size, 12 pixel (px) size, 14 pixel size
<p> Normal font size, <span class= "pt12" >12 Number of Points (PT) </span>,<span class= "pt14" >14 point size </span> </p>
<p> Normal font size, <span class= "in1" >1 inch (in) Size </span>,</p>
<p> Normal font size, <span class= "pt12" >12 Number of Points (PT) </span>= <span class= "PC1" >1 12pt Word (1pc) size </ Span>,<span class= "PC2" >2 12pt character (2pc) size </span></p>
<p> Normal font size, <span class= "em2" >2 font height (em) size </span></p>
<p> Normal font size, <span class= "Ex1" >cnbruce-ex1</span>,<span class= "Ex2" >cnbruce-ex2</span >,<span class= "ex4" >cnbruce-ex4</span></p>
<p> Normal font size, <span class= "per2" >200% font size </span></p>
</body>

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.