1440的屏幕分辨率,banner图片宽度是1600px插入图片的时候怎么写css样式才能不出现横向的滑动条

图片是直接插入的,不是背景图片,图片是不对称的
2026年09月03日 19:43
有3个网友回答
网友(1):

或者css里加上 .img{width:1440; height:按比例缩放后的大小;}或者用PS直接按比例把图片切成宽为1440的图片。。。

网友(2):

background-repeat:no-repeat;

网友(3):

#banner {width:100%;height:400px;background:url(img/bannerbg.gif) repeat-x;overflow:hidden;position:relative;}
#banner img{width:1600px;height:400px;position:relative;left:50%;margin-left:-800px;/*这个数值是图片宽度的一半*/}

html布局: