Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] :before background image scaling problem

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #147040
    tomasz86
    Participant

    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?

    #147048
    Paulie_D
    Member

    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.

    #147055
    SlimBean
    Participant

    Try looking into the ‘background-size’ property.

    #147057
    Paulie_D
    Member

    Try looking into the ‘background-size’ property.

    That’s not going to do anything on a browser re-size.

    #147076
    Paulie_D
    Member

    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.

    #151353
    dhimage
    Participant

    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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.