Forums

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

Home Forums CSS How do I add a overlaying image?

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #237755
    Alecar983
    Participant

    http://pipanel.co.uk/

    that’s my website, I used svg to make the hexagons, I was wonder if there was a easy way to overlay say this image http://goo.gl/dheZNl on the home one and etc. I wanted it to look like this picture I made in photoshop. http://imgur.com/vKLlQbd
    http://codepen.io/Alecar983/pen/KVGvQL

    #237770
    Shikkediel
    Participant

    You could just set it as a background-image to the svg…

    #237771
    Alecar983
    Participant

    the svg is transparent so you can see the background image through it, putting the house image as the background messes it up and makes that become the background of the whole website. I’m probs doing it wrong though .

    #237772
    Shikkediel
    Participant

    Try to add this, it sort of works :

    svg {
      background: url(//goo.gl/dheZNl) center;
    }
    

    Unfortunately a pseudo won’t affect an svg… but another option I can think of would be to inline the image in the svg with xlink.

    Image element

    #237773
    Shikkediel
    Participant

    Of course masking is an alternative as well but the above would be the most cross browser solution.

    #237778
    Alecar983
    Participant

    using the thing you link just applied it to all of them which I didn’t want, I wanted to have individual images on each hexagon

    #237780
    Shikkediel
    Participant

    putting the house image as the background messes it up and makes that become the background of the whole website.

    That was just to show it basically does work.

    #237783
    Alecar983
    Participant

    I got it to work on the one svg. Thanks man. Just need to figure how to move it up a little without moving the svg

    #237784
    Shikkediel
    Participant

    How about this?

    .hexagon2 {
      width: 150px;
      background: url(//goo.gl/dheZNl) top center / 65% no-repeat;
    }
    

    codepen.io/anon/pen/adRaZz

    #237785
    Alecar983
    Participant

    Nope :( That makes no image come up

    Edit: changed something and yeah that kind of fixes it, but the image is a little to high, but I reckon I could work with that, maybe.

    #237786
    Shikkediel
    Participant

    You could do some trial and error to get the background size and position right. If you want the image on top, you’ll need to use the inlined xlink approach.

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