Repeating Background Images

If your background image is smaller than the element, you can control its repetition using the background-repeat property. Values include repeat, repeat-x, repeat-y, and no-repeat.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            background-image: url(
'https://media.w3wiki.org/wp-content/cdn-uploads/20190710102234/download3.png');
            background-repeat: repeat-x;
        }
    </style>
</head>
  
<body>
    <h1>Welcome to w3wiki</h1>
</body>
  
</html>


Output



How to Add Background Image in CSS ?

Adding a background image to a webpage can enhance its aesthetic appeal and make it more engaging for users. CSS (Cascading Style Sheets) provides several properties to easily set and customize background images. In this article, we will explore different approaches to add background images in CSS.

Table of Content

  • Using the background-image Property
  • Setting Background Size
  • Positioning the Background Image
  • Repeating Background Images

Similar Reads

1. Using the background-image Property

The simplest way to add a background image is by using the background-image property. You can specify the image URL within the url() function....

2. Setting Background Size

...

3. Positioning the Background Image

You can control the size of the background image using the background-size property. Common values include cover (to cover the entire element without stretching), contain (to fit the image within the element), and specific dimensions (like 100px 200px)....

4. Repeating Background Images

...