I’ve only successfully made the background image go down vertically on the left side of the website. But I haven’t figured out how to make the background image do the same thing to the right of the webpage.
<style>
body {
background-image: url('background.png');
background-size: 950px;
background-repeat: repeat-y;
}
</style>
I’ve tried duplicating the image and making it go to the right but that didn’t work. It just ended up messing with the background image to the left go to the center.
2
Answers
If you only want your image repeat vertically but on both sides of your page. You may give 2 same backgrounds but put them on different sides:
Pay attention it’s
background
but notbackground-image
. It is a shorthand for:Here’s a live example:
You can use multiple background images in CSS. This involves specifying the same image twice, once for the left side and once for the right side, and positioning them accordingly.
One instance of the background image on the left side and another on the right side of the webpage, both repeating vertically. You can adjust the
background-size
andbackground-position
values as your requirement.