CSS writing methods that allow users to control the size of the page's font-experience exchange

Source: Internet
Author: User
Now the vast majority of sites in the country with CSS to set the font size to 12px, pixels, although the relative size units, but only relative to the screen resolution, when the screen resolution is certain, if you feel the word is too small, reading difficulties, in the non-standard browser is powerless, so say, if the unit changed to EM, Then you can use CTRL + mouse scrolling to enlarge the word, or use the menu View > Text size to change the size of the word.

How to Set

1. In the body label font size is set to 62.5%, if there is no CSS settings in the body, then the browser default size is 16px, set 62.5%, then the font size =16px*62.5%=10px, then you can use EM conveniently set the size, such as you need to use 12px , just set 1.2em.

body{
font-size:62.5%;
}

h1{
fong-size:1.4em;/* h1 Word size equivalent to 14PX */
}
2.body font size is set to 75%, the font size =16px*75%=12px,1em equivalent to 12px.

body{
font-size:75%;
}

h1{
fong-size:1.5em;/* h1 Word size equivalent to 18PX */
}

The first method is better.

If it is an English website, can also be set to small, x-small ...

Of course, the design requirements for the page will be higher.
  • 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.