html - CSS overflow container with images isn't working? -
i javascript/php programmer brand new css , having trouble getting images display in container overflow. understanding below code should display images in rows of 3 15 pixels of space between them. instead, displays 1 single image in top left of div should be. if remove id div images display down vertical line, , if remove div entirely flow rightward across page normally. when gave div background color appeared proper size , in proper location.
#items_container { position:absolute; overflow:auto; height:500px; width:500px; } .item_image { margin: 0 15px 15px 0; padding: 0 0 0 0; } <div id="items_container"> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> </div>
i tried giving container div height/width in html, , image class height/width in css. neither did anything. help, everybody!
not sure understand question, how layout structure:
html
<div id="items_container"> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> <img src="imagelocation" height="150" width="150" class="item_image" /> </div>
css
#items_container { overflow:hidden; height:500px; width:500px; } .item_image { float:left; margin: 0 15px 15px 0; padding: 0 0 0 0; }
the overflow hidden replaced clear, prefer go overflow hidden route.
after need float of .item_image elements.
Comments
Post a Comment