Forum Moderators: not2easy
i want a photo inside a div to scale to 25% of the page...
so i figure setting my div to 25% width would work.
nope, my image jumped to full size.
so i tried setting my div to no width and the picture to 25
nope, stretched the image full size again.
so... i did this
css
div.a {float: left; clear: left; width: 25%}
html
<div class="a">
<img width="100%" src="pic.jpg">
</div>
and it worked... to me that seems like unnecessary code for which CSS is supposed to get rid of.
am i doing something wrong?
div { width: 25%; }
div img { width: 100%; } or even drop the div entirely and just do:
img { width: 25%; } Does that sound about right? You shouldn't have to float your container (although that'll trigger the float 'shrink wrap' model).
[edited by: Robin_reala at 6:34 pm (utc) on June 21, 2007]