S
S
savichek2021-05-29 10:55:41
css
savichek, 2021-05-29 10:55:41

How to make a responsive image using css rules background in a block?

Hello, there is a block, text is written in it, and an image is set as the background of the block. The version of the site is adaptive, so when the browser window is narrowed, the block changes its width several times. A separate image has already been prepared for each width. And if in the case of img everything becomes clear with the help of srcset , then how can you do the same in the case of background?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sashabeep, 2021-05-30
@sashabeep

If the block is static, you need to put it in a media query, as mentioned above, if it is dynamic and it is supposed to be filled, such as an element of some list of texts, you don’t need to make it a background at all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question