商务合作
<!DOCTYPE html>
<html>
<body onresize="s()">
<div style="width:25%;color:red;" id='demo'>
<span id="zt">商务合作</span>
</div>
</body>
</html>
<script>
function s(){
var obj = /\d+/.exec(document.getElementById('demo').style.width);
var ziti=document.getElementById('zt');
ziti.style.fontSize=obj*document.body.clientWidth/100/5+"px";
}
</script>
标签:style,字体大小,ziti,js,改变,var,document From: https://www.cnblogs.com/luo9tian/p/17763058.html