Home>

I want to repeat a smaller background image.

body {
    background-image: url ("background.png");
}


I wrote css like this. When you run this css,
background.png is displayed large and is displayed only once (half of png).
How can I write to make the background image smaller and repeat?

css
  • Answer # 1

    If you use it well, you can make it smaller and repeat it.

    [background-size-CSS: cascading style sheets | MDN]
    https://developer.mozilla.org/en/docs/Web/CSS/background-size

    [Summary of the background-size property | Tips Note by TAM]

    [background-repeat-CSS: Cascading Style Sheet | MDN]
    https://developer.mozilla.org/en/docs/Web/CSS/background-repeat