Reputation: 25
The problem is now: Different smartphones have different display resolutions.
There are e.g. 840x560, 480x320 or 800x480.
What do I have to write as meta-tags, css, etc. to fit the image in "every" modern smartphone to the Display?
I hope my concern was clearly described.
Upvotes: 0
Views: 173
Reputation: 413
To target specific screen sizes you should use @media queries.
Plus background-size: cover;
will make your image fit the .block container.
See: https://developer.mozilla.org/en-US/docs/CSS/background-size
@media screen and (max-width: 840px) {
.block {
display: block;
width: 100%;
height: 100%;
background: url(/path/to/image) no-repeat center center transparent;
background-size: cover;
}
}
Upvotes: 0