0% found this document useful (0 votes)
86 views

CSS Background Image

Uploaded by

Jessica Sehgal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

CSS Background Image

Uploaded by

Jessica Sehgal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

 Menu  Log in

Dark mode
Dark code
  HTML   

CSS Background Image


‹ Previous Next ›

CSS background-image
The background-image property specifies an
image to use as the background of an element.

By default, the image is repeated so it covers the


entire element.

Example
Set the background image for a page:

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

Try it Yourself »

Example
This example shows a bad combination of text
and background image. The text is hardly
readable:

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

Try it Yourself »

Note: When using a background image, use an


image that does not disturb the text.

The background image can also be set for specific


elements, like the <p> element:

Example

p {
background-image: url("paper.gif");
}

Try it Yourself »

The CSS Background Image


Property

Property Description

background- Sets the background image for an


image element

‹ Previous Next ›

NEW

We just launched
W3Schools videos

Explore now

COLOR PICKER



Get certified
by completing
a CSS
course today!

school
w3 s
2
CE

02

TI 2
R

FI
ED .

Get started

CODE GAME

Play Game

Report Error

Spaces

Pro

Buy Certificate

Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial

Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference

Top Examples
HTML Examples
CSS Examples
JavaScript Examples
How To Examples
SQL Examples
Python Examples
W3.CSS Examples
Bootstrap Examples
PHP Examples
Java Examples
XML Examples
jQuery Examples

Get Certified
HTML Certificate
CSS Certificate
JavaScript Certificate
Front End Certificate
SQL Certificate
Python Certificate
PHP Certificate
jQuery Certificate
Java Certificate
C++ Certificate
C# Certificate
XML Certificate

FORUM | ABOUT

W3Schools is optimized for learning and training. Examples


might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed
to avoid errors, but we cannot warrant full correctness of all
content. While using W3Schools, you agree to have read
and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2022 by Refsnes Data. All Rights Reserved.


W3Schools is Powered by W3.CSS.

You might also like