S
S
seregindev2017-08-21 13:47:38
css
seregindev, 2017-08-21 13:47:38

Is it possible to automatically adjust the height of the block to the height of the background image?

Good day, I ran into a problem, I can't solve it for two days now...
Is there any way to adjust the height of the block to the height of the image specified as 'background-image' ?

Without using the height property

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Sklyarov, 2017-08-21
@0example

In your case, it's easier to do the opposite. You have a rubber block, as I understand it, therefore, in addition to background-image, you need to add another property . So the picture itself will expand under the block. background-size:cover;

D
dom1n1k, 2017-08-21
@dom1n1k

From the description it is not quite clear what exactly needs to be achieved.
But what I read and understood, I want to answer "no, it's impossible" (meaning a clean layout, without JS).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question