Home
HTML
HTML Images
Background images
Tryit: HTML background image
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>Background Image</h2> <p>A background image for a p element:</p> <p style="background-image: url('img_girl.jpg');"> You can specify background images<br> for any visible HTML element.<br> In this example, the background image<br> is specified for a p element.<br> By default, the background-image<br> will repeat itself in the direction(s)<br> where it is smaller than the element<br> where it is specified. (Try resizing the<br> browser window to see how the<br> background image behaves. </p> </body> </html>