实现显示小于 12px 的文字

imPony 发布于:2017-11-09 17:10:32

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>移动端小字号</title>
<style>
body, p { margin: 0; padding: 0; font-size: 12px; }
.small-font { margin-left: -50%; width: 200%; -ms-transform: scale(.5); -moz-transform: scale(.5); -webkit-transform: scale(.5); transform: scale(.5); }
/* 想要的字体大小、间距乘以 2 即可 */
.small-font.px9 { font-size: 18px; }
.small-font.px6 { font-size: 12px; }
</style>
</head>
<body>
    <p class="small-font px6">我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。我是 6px 的字。 @5811</p>
    <p class="small-font px9">我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。我是 9px 的字。 @5811</p>
    <p>我是 12px 的字 @5811</p>
</body>
</html>


image.png

觉得有用请点个赞吧!
0 538