CSS font size in different browser compatibility issues

Source: Internet
Author: User

CSS in the use of font-size set font size, different browser font height, but different width, such as in Firefox and Google, font-size:20px, font height to 20px, but Google's font width than Firefox long

One, the workaround is as follows:

1, set the browser's base font size to 62.5%, that is, 10px, now 1rem = 10px--for calculation convenience. Then apply Font-size:2rem on the body, and now the body font size is 20px.

{ font-size: 62.5%;}  { font-size: 2rem/** /}

2, WebKit browser rendered font has a certain smoothing effect, so we will see Chrome rendered font to be larger and wider, you can add the following:

{  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale

Enable browser's default smooth font effect CSS:

{ -webkit-font-smoothing: subpixel-antialiased; -moz-osx-font-smoothing: auto; }

Set chrome below, set less than 12px font, display still 12px

-webkit-text-size-adjust:none;

CSS font size in different browser compatibility issues

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.