Positioning in HTML/CSS? -
here html code:
<div id="slider" class="images"> <img src="img/image1.png" height=200 width=200> <p>image1 corresponding text here</p> <img src="img/image2.png" height=200 width=200> <p>image2 corresponding text here</p> <img src="img/image3.png" height=200 width=200> <p>image3 corresponding text here</p>
<div class="switch_image"> <a href="#" id="prev">prev</a> <a href="#" id="next">next</a>
- how can change text location to right of image , not below it?
- after above question answered, images stacked on top of each other, how can space images apart margin?
- once done, how can each image , it's corresponding text move respect original position when re-size broswer window?
i'd suggest wrapping images , text:
<div id="slider" class="images"> <div class="single-image"> <img src="img/image1.png" height=200 width=200> <p>image1 corresponding text here</p> </div> <div class="single-image"> <img src="img/image1.png" height=200 width=200> <p>image1 corresponding text here</p> </div> <div class="single-image"> <img src="img/image1.png" height=200 width=200> <p>image1 corresponding text here</p> </div> </div>
then in css like:
.images { overflow: hidden; /* dirty way of self-clearing floats */ } .single-image { overflow: hidden; float: left; margin: 10px; width: 300px; } .single-image img { float: left; } .single-image p { float: right; width: 90px; }
example: http://jsbin.com/alobiw/1/edit
Comments
Post a Comment