views:

47

answers:

1

What would be the best way to resize a content div to match the browser, keeping a white margin around it, whilst also resizing an image contained within it, so that it keeps a good aspect ratio?

this is the effect i am looking to create: http://www.louisvuitton.com/

A: 

You would set the margins of the container whether that is the body or another block element container

body {margin:20px;}
mjw06d
thanks, thats simple enough. Im using:
davivid
body {padding:0;margin:0px;overflow:hidden;} #content {margin:25px;} img {width:100%;height:auto;}
davivid
except I do not get any margin at the bottom? Also how could I get the image to kind of vertically center itself so that the focus is always on the middle, rather than just showing the top if you resize to very thin.
davivid