Languages
[Edit]
EN

CSS - disable image background repeating

0 points
Created by:
Kevin
367

In this article, we would like to show you how to disable image background repeating using CSS.

Quick solution:

body {
  background-repeat: no-repeat;
}

 

Practical example

In this example, we disable image background repeating using background-repeat property set to no-repeat.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>

    body { 
      height: 300px;
      background-image: url("https://dirask.com/static/bucket/1631891312626-6pQmxaWAb5--background-h200px.jpg");

      /* required */
      background-repeat: no-repeat;
    }

    div {
      padding: 10px;
      color: white;
    }

  </style>
</head>
<body>
  <div>Example text...</div>
</body>
</html>
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join