• 长度rem的使用


    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="robots" content="all">
    <meta name="format-detection" content="telephone=no" />
    <style type="text/css">
    *{padding: 0;margin: 0;}
    html,body{100%;height: 100%;font-family: "Microsoft YaHei"; position: relative;}
    .banner{height:230px; 414px;background: red}
    </style>
    <script type="text/javascript">
    
    	//var num=$(window).width();
    	var num= window.innerWidth;
    	var font=num/10;
    	document.getElementsByTagName('html')[0].style.fontSize=font+'px'
    	//$('html').css('font-size',font+'px');
    	/* window.onresize=function(){
    	num=$(window).width();
    	font=num/10;
    	$('html').css('font-size',font+'px');
    	} */
    </script>
    <title>平台</title>
    </head>
    <body>
    	<div class="banner">
    	</div>
    <script type="text/javascript">
    var html=$('html').html();
    var remhtml=html.replace(/(d+)px/g, function(a,b){
    	console.log(b)
    	var num=b/41.4+"";
    	console.log(num)
    	return num.substring(0, 5)+"rem";
    })
    console.log(remhtml);
    </script>
    </body>
    </html>
    

      

  • 相关阅读:
    WeakReference体验
    扩展Jquery自定义的一个错误警告控件ErrorProvider
    提高WCF的吞吐效率
    (三)资源
    替换WCF默认序列化方式
    (二)画刷
    JS字符串函数扩展
    索引
    Jquery ajax传递复杂参数给WebService
    有意义的整数正则表达式
  • 原文地址:https://www.cnblogs.com/liuhao-web/p/6394733.html
Copyright © 2020-2023  润新知