What if you could fill a whole page with a pattern by writing just one line of code?
Why Background repeat in CSS? - Purpose & Use Cases
Imagine you want to decorate a webpage with a pattern, like tiny stars or dots, by placing the same small image multiple times across the background.
If you try to place each star image manually, you would have to copy and position each one by hand, which takes a lot of time and is very hard to keep neat and consistent.
The background-repeat property in CSS automatically repeats a background image horizontally, vertically, or both, so you don't have to place each image yourself.
background-image: url('star.png'); /* then manually add many elements with the image positioned */
background-image: url('star.png');
background-repeat: repeat; /* repeats the image across the whole background */You can easily create beautiful repeating patterns that fill any size area without extra work.
Websites often use repeated background patterns like polka dots or stripes to add style without slowing down the page or making it complicated.
Manually placing repeated images is slow and messy.
CSS background-repeat repeats images automatically.
This makes styling backgrounds fast, neat, and flexible.