Use CSS to flexibly set the font size

Source: Internet
Author: User
Use Div + CSSIt may take some time to write the website structure. In this process, we find that we need to set the font to a ratio of 12px, the font size is smaller than 14px (13px cannot be distinguished from 12px in IE ). Today we found that using font-size: small; can well control the font size.

First, set a base value in the tag.

Body {font-size: small ;}

Set the percentage in other labels based on the font size.

H1 {font-size: 120% ;}
H2 {font-size: 110% ;}
Note {font-size: 80% ;}

As the base value changes, other fonts also change. You only need to modify the Base Value in the body.

Using small as the base value allows you to adjust the size based on your preferences. user adjustment does not affect the overall font imbalance. At the same time, when you press Ctrl + scroll the middle mouse button, you can also scale the font size of the page.

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.