Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,
I want to set background of my DIV using an image and repeat this image in x axis.
Here is my code but it does not work.

CSS
div.header
{ width:1000px; border-radius:10px; height:120px; content:url(html_bg.jpg) repeat x;}


Thanks & Regards
Bigyan Ranjan Sahoo
Posted
Comments
ZurdoDev 3-Oct-14 14:06pm    
FYI, it would have been much faster to google this than to post and wait here.

The content property[^] is only used with the :before and :after psedo-elements.

Use the background property[^] instead.
CSS
div.header
{
    width: 1000px;
    border-radius: 10px;
    height: 120px;
    background: url(html_bg.jpg) repeat-x;
}
 
Share this answer
 
Comments
ZurdoDev 3-Oct-14 14:06pm    
+5
Afzaal Ahmad Zeeshan 3-Oct-14 14:12pm    
+5, you've provided a good solution for him. :-)
+5. Check my answer as well. :)
Just to support what Richard suggested here is the demo - [Demo] Div Background Image Repeat in x Direction[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900