您的位置:首页 > 其它

窗口缩小时图片、文字跟着整体缩小

2015-08-19 16:00 260 查看
 .content_left{width:48.5%; float:left; padding:3% 3% 0px 0px; display:block;}

.content_left img{min-width:100%;width:280px;vertical-align: middle;width:expression_r(document.body.clientWidth>100?"100%":"auto");

overflow:hidden;}

窗口缩小文字跟着自动缩小

<!DOCTYPE HTML> 

<html> 

<head> 

    <meta charset="UTF-8"> 

    <title>CSS3 Demo</title>

    <style type="text/css">

        #box { width: 10em; padding: 15px; font-size: 1em;}

        #box2 { font-size: 4vw;}

    </style>

</head>

 

<body>

    <div id="box">

        Nihao a 你好 啊啊 啊啊 哈牛粪打款三幅画

    </div>

    <div id="box2">

        我们都是好孩子啊啊2

    </div>

<script type="text/javascript">

window.onresize = function(){

    var box2 = document.getElementById("box2");

    box2.style["z-index"] = 1;

}

</script>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: