超大图居中的方法

2024-10-13 21:58:04

1、使用绝对定位html代码<div class="wrap"><div class="banner"><img src="img1.jpg"/></div></div>

2、css代码.wrap{width:100%;overflow:hidden;}.banner{width:1920px;margin-left:-960px;left:50%;position:relative;}

3、效果

超大图居中的方法超大图居中的方法

4、使用相对定位html代码<div class="bannerbox"> &造婷用痃lt;div class="banner"> <img src="img1.jpg"> </div> </div>

5、css代艨位雅剖码.wrap { width:100%;position:relative; overflow:hidden; height:470px; }.banner {width:1920px;position:absolute; left:50%; margin-left:-960px;}

6、效果

超大图居中的方法
猜你喜欢