background-image

The background-image CSS property sets the background image(s) of an element. Two types of images can be specified by this property: regular images (e.g. png, jpg, svg, gif, webp) or gradients.

Values of background-images

none | url() | inherit

none – no image

url() – the path to the background image

Examples

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

There is also possible to set data URI for the url(), for exmaple:

div {
    background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE8AAABPCAYAAACqNJiGAAAgAElEQVR4nI28d1xO....);
}

Related

Resources

Browser compatibility

background-image

Internet Explorer
4.0
Firefox
1.0
Chrome
1.0
Safari
1.0
Opera
3.5
Mobile
Safari Mobile
works
Android
works
Chrome Mobile
works
IE Phone
works
Opera Mini
works
Opera Mobile
works

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.