mercredi 10 août 2016

Move the page with the font more small change the font size

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>兑换产品</title>
<script>
(function(){
        var
                phoneScreenWidth = window.screen.width,
                createMeta = document.createElement("meta"),
                initScale = phoneScreenWidth/640;
        var metaAttr = {
                "name":"viewport",
                "content":"initial-scale="+ initScale +", maximum-scale=1, user-scalable=no, width=640"
        };
        for(var key in metaAttr){
                createMeta[key] = metaAttr[key];
        }
        document.getElementsByTagName("head")[0].appendChild(createMeta);
})();
</script>
<link rel="stylesheet" href="css/mycss.css" >
</head>
<body class="bg_img">
<div class="box_c clearfix">
</div>
<style>
*{margin:0px;padding:0px;}
.con_txt{width:100%;}
.con_txt  >div{width:100%;font-size:18px;}
</style>
<div class="con_txt">
        <div>1. 资格并填写《部特惠写《部特惠写《部特惠写《部特惠</div>
</div>
</body>
</html>

enter image description here

enter image description here

从以上图看到:一样的代码,div里面的文字内容变多了,div的字体大小就失效了,请问下是什么原因造成的?上面的主要是写移动端的页面自适应,全局用px做的单位,跟pc和平板没什么关系,pc上调请打开手机模式

Aucun commentaire:

Enregistrer un commentaire