it's just occurred to me that i don't know how to position a div centrally (ie with an equal margin on either side) within a div.
i'm going for this effect here but as you can see, that div extends waaaay too far out to the right. i'd like that picture to sit equidistant between the left and right border of the encompassing div. would someone be so kind as to tell me how to go about this?
i'm going for this effect here but as you can see, that div extends waaaay too far out to the right. i'd like that picture to sit equidistant between the left and right border of the encompassing div. would someone be so kind as to tell me how to go about this?
Code:
body{padding: 20px;background-color: #3467b0;
font: 70%, Arial,sans-serif; color: #ffffff}
#container { margin: 0px auto; width: 720px; border: #000000 1px solid; }
#photo { margin: 0px auto; background-color: #ffffff; float: left; }
.clear { clear: both; padding: 0px; visibility: hidden; height: 1px; margin: 0px; }
div {
padding: 0;
margin: 0;
}
Code:
<div id="container">
<div id="photo">
<img src="gallery/chewyfingers.jpg" />
</div>
<div class="clear"></div>
</div>