Open links in new tab
  1. W3School
    https://www.w3schools.com/css/css_background_image.asp
    CSS Background Image - W3Schools
    Learn how to use the CSS background-image property to set an image as the background of an element. See examples, video, and tips for choosing a suitable background image.
    Tryit Editor V3.7
    The W3Schools online code editor allows you to edit code and view the result in y…
    Try It Yourself
    The W3Schools online code editor allows you to edit code and view the result in y…
    Background Repeat
    W3Schools offers free online tutorials, references and exercises in all the maj…
    CSS Backgrounds
    You learned from our CSS Colors Chapter, that you can use RGB as a co…
    Background Attachment
    CSS Dropdowns CSS Image Gallery CSS Image Sprites CSS Attr Selectors CSS …
    CSS background-image Property
    The background-image property sets one or more background images for an ele…
    Feedback
     
  1. background-image - CSS: Cascading Style Sheets | MDN - MDN …

  2. 123

    The background-image property in CSS is used to set one or more background images for an element. This property can be applied to any HTML element.

    Example

    body {
    background-image: url('background.jpg');
    }

    This example sets a background image for the entire page1.

    Multiple Background Images

    You can also set multiple background images by separating them with commas.

    body {
    background-image: url('image1.png'), url('image2.png');
    }

    In this example, image1.png will be layered on top of image2.png2.

    Gradients as Background Images

    CSS allows you to use gradients as background images.

    body {
    background-image: linear-gradient(to right, red, yellow);
    }

    This example creates a linear gradient from red to yellow3.

    Fallback Color

    Always specify a fallback color in case the image fails to load.

    body {
    background: url('background.jpg') blue;
    }

    In this example, if the image fails to load, the background color will be blue3.

    Was this helpful?

    See results from:

  3. CSS background-image Property - W3Schools

    Tags:
    CSS Background-Image
    Cascading Style Sheets
    no. Read about animatable
  4. Background-image - CSS-Tricks

    Feb 17, 2015 · Learn how to use background-image to apply graphics or gradients to the background of an element. See examples of regular images, data URIs, sprites, multiple backgrounds, and more.

    Tags:
    CSS Background-Image
    Cascading Style Sheets
    Background Css Property
  5. background - CSS: Cascading Style Sheets | MDN - MDN Web Docs

    Tags:
    Cascading Style Sheets
    Background Css Property
    Web Background
  6. HTML Background Images - W3Schools

    Tags:
    CSS Background-Image
    Background Css Property
    HTML Background Images
  7. How to Add Background Image with CSS - W3docs

    Learn how to use CSS properties to add, position, repeat, size and opacity background images in HTML documents. See examples, code snippets and live demos.

    Tags:
    CSS Background-Image
    Css Background Image
    HTML Background Images
  8. Backgrounds - web.dev

    Tags:
    CSS Background-Image
    Background Css Property
    Css Background Image
  9. CSS Background Image – With HTML Example Code

    Jul 21, 2021 · Learn how to add, position, resize, repeat, and attach background images to HTML elements using CSS properties. See examples, syntax, and code snippets for different effects and scenarios.

    Tags:
    CSS Background-Image
    Css Background Image
  10. CSS background-image Property - W3docs

    Learn how to use the CSS background-image property to add images, gradients or patterns to elements. See syntax, values, examples and browser support.

    Tags:
    CSS Background-Image
    Background Css Property
    Cascading Style Sheets
  11. Some results have been removed