根据大家提供的我整理了一下。你们可以看看
.m-switchi .img{/外面的div/
display:inline-block;
width:160px;
height:80px;
border:2px solid #353d48;
box-sizing: border-box;
}
.img img{
width:100%;
height:100%;
border:1px solid #353d48;
}
.img img[src='']{
opacity:0;
}
大同小异的另一种
Documentimg{width:100px;height:100px;border:0;outline:0;vertical-align: top}
/*img[src=""]{opacity:0;}*/
/*div{border:2px solid #f00;display:inline-block;}*/
img{padding:1px;margin:-2px;}
div{border:1px solid #f00;display:inline-block;overflow:hidden;}

这篇博客探讨了CSS中`.switchi`和`.img`类的样式设置,包括宽度、高度、边框以及透明度的调整,展示了如何实现图片的显示与隐藏。同时,提到了图片的内边距和外边距处理,以及使用`display:inline-block`和`overflow:hidden`来控制元素的布局和溢出处理。
3143

被折叠的 条评论
为什么被折叠?



