Click here to Skip to main content
15,907,392 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
C#
How to give background svg image repeat-x property?i am trying to svg repeat-x but it not working.give me solution.


What I have tried:

My code like this

background-image: url(../images/cloud-1.svg);
background-repeat: repeat-x;
width: 100%;
height: 200px;
display: block;
background-size: 100% 150px;
Posted
Updated 17-Dec-16 4:02am

1 solution

I do not have your HTML or your image, but this is what I know. With the Scalable Vector Graphics (SVG) image, you must add the exact height and width of the image. In your example, you have background-size set at 100%; which will not work. Below is a working example of proper SVG as a horizontal repeating background image. If you'd like to dig deeper, then here is a good article: Using SVG | CSS-Tricks[^]


HTML
<!DOCTYPE html>
<html>
<head>
<style>
body {
    background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/SVG_logo.svg/240px-SVG_logo.svg.png");
    background-repeat: repeat-x;
    background-size: 240px 240px;
}
</style>
</head>
<body>

<p>repeat-x will repeat a background image only horizontally.</p>

</body>
</html>
 
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