Chrome displays solutions for the following fonts in 12px

Source: Internet
Author: User

The demo is as follows:

<!doctype html>

<title>chrome display 12px The following font resolution method </title>
<style type= "Text/css" >
* {
margin:0px;
padding:0px;
Font-family: "Microsoft Jas Black";
}
. px12 {
font-size:12px;
}
. px10 {
font-size:10px;
}
. px8 {
font-size:5px;
}
</style>
<body>

<div class= "px12" >
I'm a 12px.
</div>

<span class= "px10" > I am 12px</span>
<br/>

<div class= "px8" >
I'm a 8px.
</div>

</body>

When this is written, Chrome is not compatible and displays 12th-number fonts, such as:


The first method:

Online Search solutions are:

can use the WebKit kernel of the-webkit-text-size-adjust of the private CSS properties to solve, such as the following code can be successfully resolved, through which the font size will not be affected with the terminal device or browser. The style is defined as follows:

#chrome10px {-webkit-text-size-adjust:none; font-size:10px;}

Just add the-webkit-text-size-adjust:none; The font size is not limited.

Note: However, it is not available after Chrome has been updated to version 27.

The second method:

Another way is to make the text on the picture.

The third method:

Use-webkit-transform:scale (0.5);

Add in Style

  . px12 {
        font-size:12px;
   
   . px9 {
        font-size:9px;
        Display:inline-block;
       -webkit-transform:scale (0.75),        /* 12*0.75=9 */
  &NBSP ;
   . px6 {
        font-size:6px;
        Display:block;
       -webkit-transform:scale (0.5),        /* 12*0.5=9 */
        Float:left;
   }

Note that -webkit-transform:scale (0.75), which shrinks the size of the entire span, must be converted to block elements, and display:block/inline-block/can be used ... ;

Effects such as:


Chrome displays solutions for the following fonts in 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.