I have used a texture as background of a div.But its not working accurately.The background is like the following image. How can I fix the problem??
The css code that i have used is
.promotion { background:url(img/promotion_image.png); background-repeat:repeat; background-position:0 0; }
You could do something like this:
.promotion {
background: url(img/promotion_image.png) repeat top left;
}
and it should work with just one line of code.
Mind that width and height are necessary for the div to be displayed.
here's a fiddle: http://jsfiddle.net/r3uLf3w1/
You're setting the background
property, which is a shorthand of all the background-...
properties, possibly overwriting the properties defined later. Please try the following code:
.promotion {
background-image: url(img/promotion_image.png);
background-repeat: repeat;
background-position: 0 0;
}
Note the background
property is now set to background-image
.
you can try this
.promotion {
background: url("image path") repeat 0 0;
}
You have to set a width and height to the class of the div. Did you do this ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.