当前第2页 返回上一页
图片在一个盒子内
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <style type= "text/css" >
#box {
width: auto;
height: auto;
max-width: 600px;
max-height: 500px;
border: 5px solid yellow;
}
img {
width: auto;
height: auto;
max-width: 100%;
}
</style>
<body>
<div id= "box" >
<img src= "https://i.loli.net/2018/06/17/5b2639a6e6c61.jpeg" alt= "timg.jpeg" title= "timg.jpeg" />
下面的文字
</div>
</body>
|
ps:
1 、利用width height auto 来缩放
2、利用max-width max-height 来设置最大宽高,为100%表示可原始最大。
以上就是css怎么让图片随屏幕变化大小的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
css里一段字没有充满一行怎么办
css背景图片怎么自适应
css之简单的响应式的实现
vue框架是什么
什么是web安全色?
css中的单选怎么做
css选择器可以插入图片吗
css如何增加权重
css如何增加下划线
html5怎么去除超链接的下划线
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css怎么让图片随屏幕变化大小