sorry I know similar questions have been asked but I still can't work it out. I want the images in the body to be centered but only when the aspect ratio means that there is white space on the right hand side, I have tried using margin: 0 auto but to no avail.
Here is my HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="landscape">
<img class="topslide" src="images/background/topslide.jpg"/>
<img class="middleslide" src="images/background/middleslide.jpg"/>
<img class="bottomslide" src="images/background/bottomslide.jpg"/>
</div>
<div id="portrait">
<img class="topslide" src="images/background/topslideland.jpg"/>
<img class="middleslide" src="images/background/middleslideland.jpg"/>
<img class="bottomslide" src="images/background/bottomslideland.jpg"/>
</div>
</body>
And here is my css:
html{
margin:0 auto;
width:100%;
}
body{
margin:0px auto;
height: 100%;
width: 100%;
background: url(../image/background/background.jpg) ;
}
@media screen and (orientation:landscape) {
#landscape {display:block;}
#portrait {display:none;}
}
@media screen and (orientation:portrait) {
#landscape {display:none;}
#portrait {display:block;}
}
#landscape{
margin: 0 auto;
}
#portrait{
margin: 0 auto;
}
img.topslide{
display:block;
max-width:100vw;
height:33.3vh;
}
img.middleslide{
display:block;
max-width:100vw;
height:33.3vh;
}
img.bottomslide{
display:block;
max-width:100vw;
height:33.3vh;
}
I'll be grateful for any help, thanks.