How do I have an image, irrespective of portrait or landscape:
Here's a solution that satisfies all of the above with only basic CSS (no CSS3 required):
http://jsfiddle.net/dvidby0/sytj1uws/1/
HTML
CSS
.container {
width: 80%;
height: 80%;
position: absolute;
margin:auto;
top:0;
bottom:0;
left:0;
right:0;
background-color: #aaa;
}
img {
max-width: 100%;
max-height: 100%;
position: absolute;
margin:auto;
top:0;
bottom:0;
left:0;
right:0;
}
讨论(0)