The right solution for Google's default minimum font 12px (CSS, HTML)

Source: Internet
Author: User

Today morning meeting, product requirements to the previous 12px font to a smaller, I thought it was difficult, just casually agreed. Do not know, when changing the CSS, Google browser font-size less than 12px, the font will not be reduced. My first reaction was whether the other CSS would overwrite the font. The results have not been found for a long day. So, only a group of Baidu, the result is really surprising: the original Google and Google kernel browser in Chinese language, the smallest font can only be 12px. Do not know if this is a bug or Google humanized design. Regardless of that many, anyway to solve this problem ~ Since this is a classic compatibility problem, there must be a lot of solutions. Surprisingly, the Baidu gang, all the solutions on the Internet are surprisingly similar:

html{

-webkit-text-size-adjust:none;

}

Then I used it with gladness, and found that there was no bird to use. Later, we looked at the information and learned that after Chrome 27, the support for this attribute was canceled. This isn't a pit-daddy, is it? Vista, and then found another workaround:

. small-font{
font-size:12px;
-webkit-transform-origin-x: 0;
-webkit-transform:scale (0.90);
}

With CSS3 scaling, the final size is: 12px * 0.9 (scale) = 10.8px;

It can be done. But back to think, so write, IE7 IE8 will not be incompatible, or 12px? As expected, it is not compatible. At this time, and then back to think, or add a style font-size? Tried, sure enough compatible with Google, IE7,IE8, the code is as follows:

. small-font{

font-size:12px;
-webkit-transform-origin-x: 0;
-webkit-transform:scale (0.90);
}


. smallsize-font {
font-size:10.8px;

}

<p style= "color: #FF0000;" class= "Small-font Smallsize-font" > Warm tips:</p>

The right solution for Google's default minimum font 12px (CSS, HTML)

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.