K
K
kamisarlapsha2017-05-09 18:09:51
css
kamisarlapsha, 2017-05-09 18:09:51

How to draw a background image correctly?

Hello. Such a question is how to properly prepare background images for the site, especially for retina monitors. What size should the background image be, and is there any criteria for background images?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A person from Kazakhstan, 2017-05-09
@LenovoId

body {
    background-image: url("pic.png");
    background-size: cover;
}

@media (-webkit-min-device-pixel-ratio: 2), 
(min-resolution: 192dpi) { 
    body {
        background-image: url("pic-2x.png");
    }
}

or like this :
body {
    background-image: url("pic.png");
    background-image: -webkit-image-set(url("pic.png") 1x, url("pic-2x.png") 2x );
    background-size: cover;
}

but in general, svg has proven itself excellent on retina, it’s better to read about it svg-art.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question