Nathan Couch
Nathan Couch

Reputation: 222

Background Image Placement in CSS

This is a simple question about CSS, but I am not sure I know how to ask it correctly. Basically, I have an image that I wanted repeated both x and y. But even though this image is repeated, is it possible to style it as if the image was positioned absolutely?

Take this image here: https://samraines.herokuapp.com/assets/paper-d5baa328bec5b7c9fe4cf98bba88452e.png, and look at it here: https://samraines.herokuapp.com/shows . This is what I was wanting to use this style on, but was unsure if I could accomplish and "absolute" style due to the image's size.

Clarifying once more, I want the image to repeat, but appear as if it was fixed.

Thanks for your help.

Upvotes: 0

Views: 99

Answers (1)

Michal
Michal

Reputation: 3632

Try this css:

.element {
    background-image: url(...);
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto;
    background-attachment: fixed; // if you do not want to scroll image with site
}

like here http://codepen.io/Chovanec/pen/dkFDp

Upvotes: 1

Related Questions