HTML BACKGROUND IMAGES


Background Image on an HTML element

You can specify background images
for any visible HTML element.
In this example, the background image
is specified for a p element.
By default, the background-image
will repeat itself in the direction(s)
where it is smaller than the element
where it is specified. Try resizing the
browser window to see how the
background image behaves.


Background Image on a Page

Give style for body


Background Repeat

In Style give background repeat as no repeat

Background Cover

If you want the background image to cover the entire element, you can set the background-size property to cover. Also, to make sure the entire element is always covered, set the background-attachment property to fixed:

Background Stretch

to stretch to fit the entire element, you can set the background-size property to 100% 100%