Google does not support the ultimate solution for fonts smaller than 12px

Source: Internet
Author: User

 

Every browser manufacturer has its own design subjectivity, and these starting points seem good but often hurt programmers deeply.

 

1. Requirements

The rendering is specified as a Google browser and the font size is 6-8 PX (to print small sizes ).

 

2. Explore 2.1 CSS hack

Multiple web pages searched for N point to one result:

Html
{      -webkit-text-size-adjust:none;}

Put the above Code at the beginning of the document...

 

Yes, that is, it does not take effect... The result is a series of reactions, such as rough tone, blushing, and wide-eyed.

 

2.2 spring of CSS 3

I just brought a book about the characteristics of css3. I quickly browsed the entire book and found a feature:

div {    transform:scaleY(0.8);}

--Scale the specified tag. For example, the code above means that the height (y) of the DIV and its child elements (including text and font size) is reduced to 80%.

Similarly, scale down the width: scalex (Pre), Overall scale-down (Pre).

 

Try to scale down.

However, if HTML is like this:

<div id="d1">your text</div><div id="d2">your text2</div>

So there will be a lot of white space between D1 and D2. How can I leave this white space?

Two rules:

{     margin-top:-12px;               padding-bottom:-12px;}

Using the negative value of Marin, you can move the margin to the specified direction, that is, the entire element;

Using the negative value of padding, you can move the padding to the specified direction, that is, supporting the big dollar margin;

 

After that, the reduced text does not change, so it achieves the effect-scale down the font in the Google browser and perform the same operations as normal.

3. Summary

Transform is actually an implementation of computer graphics, such as 2D transformation and 3D transformation.

The Foundation is very important, and every effort will not be wasted ~.

Google does not support the ultimate solution for fonts smaller than 12px

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.