超宽图片怎么居中显示 隐藏左右多余的部分
/*外层DIV*/
div {position: relative;overflow:hidden;width: 显示宽度px;}
/*left=50%刚好在中间,margin-left=往前移动图片一半,这是图片就是居中了*/
img {border:none;width: 图片宽度px;position:absolute;top:0;left:50%;margin-left: -图片宽度一半px;}
or
.juzhong {position: relative;overflow:hidden;width:100%; height:auto;}
.juzhong img {border:none;width: 100%;position:relative;top:0;left:50%;margin-left: -50%;}版权保护: 转载请保留链接: https://cgy.isi8.cn/jianzhan/119.html
- 上一篇:客服弹窗
- 下一篇:鼠标指向文字时,显示图片
