用js当页面大小改变时改变字体大小
商务合作
<!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>