0
I put a photo of the background, being 100% tall.
When I open the site by mobile (or Chrome/Firefox console) in landscape mode, the image background does not take up all the space.
In desktop mode and mobile mode in portrait position they are ok. Only LANDSCAPE so that is a problem.
I want in landscape mode, the content is to set the view window. How to do this?
MOBILE: MODE LANDSCAPE, div doesn’t fit according to content.
OBS1: Run the Snippet on the browser console. In the mobile simulator for you to understand what I mean-do.
body, html {
height:100%;
padding:0;
margin:0;
}
.block {
height: 100%;
width: 100%;
text-align: center;
background: black;
}
.block:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.centered {
margin-top: 10%;
display: inline-block;
vertical-align: middle;
max-width: 500px;
background: white;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
<div class="block">
<div class="centered">
<img src="https://upload.wikimedia.org/wikipedia/commons/6/6f/HP_logo_630x630.png" class="img-responsive" id="img_logo">
<p style="color: black"> <a style="font-size:35px;"> xxxxxx</a> <br><br>text text <br> address <br> </p>
</div>
</div>
I tried to remove the .block before: and:
@media(orientation: landscape){
.background-image {
min-height: 200%;
}
}
But, this effect doesn’t only work in MOBILE mode. It works on both MOBILE and DESKTOP. I want it to work only on MOBILE.
Desktop also does not work right :/
– Guilherme Nascimento
@Zkk you did the test on the same device or just in simulators, sometimes the results differ a lot... Post your website and access on your mobile phone.
– Paulo Roberto
Both here in the stack and on my desktop machine is working. It’s just the image in the center and nothing else! Also put on the air and the same thing. Destkop OK. Mobile (only in LANDSCAPE mode) This error.
– Zkk
How can I fix this?
– Zkk
As I said the problem occurs on the desktop too and is due to the
height: 100%
. See the answer I formulated and the example I posted to try to correct.– Guilherme Nascimento