Design a high user experience Web text size with CSS

Source: Internet
Author: User
Tags numeric value relative movable type

There is nothing more important in developing a Web application than it looks. So, I wouldn't be surprised to find that designers are very concerned about fonts and font sizes!

When designing a network application, you must decide how to edit the font. There are a number of options when using CSS, and each developer has its own preferences. This article mainly discusses the font size and the operation within the network application.

  Font size

The CSS2 specification defines fonts based on length--Horizontal and vertical dimensions. This length is a numeric value and may be preceded with an optional plus (+) or minus (-) marker. In addition, the value may have an optional unit identifier after it.

In addition, the CSS2 specification defines two unit types: absolute units and relative units. The absolute value specifies the unit, and the relative unit specifies a value that is proportional to another value. The following list lists the relative unit identifiers:

    • EM: The height of the element font. It evaluates to the same value as the font size property of the element that uses the font. When it appears in the font Size property value itself, an exception occurs when it refers to the font size of the parent element.
    • Ex (x-height): The CSS2 specification describes it as the height of the lowercase letter x.
    • PX (pixels): It is related to the resolution of the background or screen. Depending on the display resolution output of different pixels, due to user preferences, the display resolution may vary greatly.

The following are valid absolute unit identifiers:

    • In (inches)
    • CM (cm)
    • MM (mm)
    • PT (dot, 1 o ' =1/72 inches)
    • PC (12-point movable Type, 1pc=12 point)

Another way to measure absolute size is to apply the following keywords: minimum, small, small, medium, large, large, and minimum, using the proportional factor that measures a value. As the base value, smaller to subtract a factor, to increase a factor, and so on. The scale factor defined by the CSS2 specification is 1.2, and this value may vary depending on the browser.

You can also apply a percentage value to format text. The percent value is an optional marker, which is followed by a percent sign (%). The percent value is always proportional to another value. In the case of a font, it is proportional to the basic font size of the Web page.

As you can see, there are many ways to do this seemingly simple task of rendering text. The following HTML-formatted text (in a paragraph element) applies various unit identifiers. All of these values are equal and are assumed to be displayed in 72dpi.

The following is a reference fragment:
<title>font sizing-equal values</title>
<p style= "FONT-SIZE:36PT;" >Point</p>
<p style= "font-size:3pc;" >Pica</p>
<p style= "font-size:0.5in;" >Inches</p>
<p style= "font-size:1.27cm;" >Centimeters</p>
<p style= "font-size:12.7mm;" >Millimeters</p>
<p style= "font-size:300%;" >Percentage</p>
</body>

You can add a pixel value to the list, but its value depends on the environment. For example, my laptop with 1280x1024 resolution will display text that is consistent with the 50 pixel values used in the table above.

Read the CSS2 specification mentioned earlier to get more knowledge of font size. Now I'll talk about deciding which method to use in a Web application.

Related Article

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.