Forums

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

Home Forums CSS Have a background image with a transparent colour

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #185012
    ItsMatt
    Participant

    I’d like to be able to have a background image with a transparent colour covering the image. But when I try to put background-image: url(mylocation);
    background-color: darkgray;
    opacity: 0.5;

    inside the body {} tags, the image shows, but not the colour, and everything else is transparent. I’m pretty sure that everything else is transparent because they’re all child section of the body, but how would I fix this, so that it’s the way I’d like it to be?

    Thanks!

    #185033
    Paulie_D
    Member

    Well you have a few options…the most obvious being to change the image in image editing software.

    The second is a pseudo element on the body like so

    http://codepen.io/Paulie-D/pen/GAKkz

    and third (which is a little more complex) multiple background ‘images’ where the ‘ transparent color’ is a gradient (albeit one that doesn’t change)

    http://codepen.io/Paulie-D/pen/onBut

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