- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Is it possible to have a background image in :before scale in the same way as a normal image (img) scales?
http://codepen.io/tomasz86/full/BerCi
If you shrink the browser window this happens:
When the “normal” image shrinks, the text below moves together with it but in case of the image inserted using background in the :before pseudoclass there’s empty space there due to custom height set. Without the height setting the image isn’t displayed at all.
Has anyone got any ideas?
Nope…it’s a background image…it’s not going to affect the dimensions of the element of which it’s the background.
You have to have some way of affecting the element itself.
Try looking into the ‘background-size’ property.
Try looking into the ‘background-size’ property.
That’s not going to do anything on a browser re-size.
background-size will always adjust the size of the background, even during a browser resize…
Really?…Even if you’re NOT changing the size of the element. How would that work?
It might work on the <html>
or <body>
but a random div (that’s not percentage based) or pseudo element (ditto)…I doubt it.
Of course, if you can make a Codepen proving me wrong…it may have uses I haven’t considered.
check this image scaling library in vb.net, it does a good job in this aspect. besides the backgroud image can be choosen. i am sure you can find some way to adjust the proportion problem.