southpaw93
southpaw93

Reputation: 1961

CSS positioning images inside div

how do I position n images inline inside a div even if the div is to small for all image to fit inside, I want the ones that don't fit to go underneath the div margin and dissapear. For example, I have:

<div id="container">
<img1>
<img2>
<img3>
<img4>
<img5>
.... n -images
</div>

Thank you.

Upvotes: 0

Views: 147

Answers (1)

Tom van der Woerdt
Tom van der Woerdt

Reputation: 29975

#container {
    width: 600px;
    height: 200px;
    overflow-x: hidden;
}

This will hide anything that goes outside the container element. Do note that some browsers could still allow the user to scroll in the hidden part, although that shouldn't happen on desktop browsers.

Upvotes: 3

Related Questions