开发者

HTML Pictures Horizontial Row

开发者 https://www.devze.com 2022-12-18 19:42 出处:网络
I was wondering if there was a开发者_开发问答 way to make a div containing images have an overflow that scrolls horizontially, as depicted in the projected diagram below:

I was wondering if there was a开发者_开发问答 way to make a div containing images have an overflow that scrolls horizontially, as depicted in the projected diagram below:

alt text http://www.zip-cover.com/development/image_carosoul/slideshow.jpg

as always, any help is greatly appreciated


Something like this should work:

#imageContainer { 
  height: 200px;
  overflow: auto; 
  white-space: nowrap; 
}

Make sure the images aren't higher than the height parameter.


You need to know the width and amount of images inside the div to prevent it from wrapping:

<div id="outer">
    <div id="inner" style="width: 3200px;">
        <img src="1.jpg" />
        <img src="2.jpg" />
        <img src="3.jpg" />
        <img src="4.jpg" />
    </div>
</div>

And in CSS:

#outer {
    overflow: hidden;
    width: 800px;
    height: 600px;
}

#inner {
    height: 600px;
}

This example assumes your images are 800x600px, adjust as necessary.


Try just

overflow-x: auto;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号