Home
CSS
CSS Backgrounds
Background Shorthand
Tryit: Background shorthand property
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> body { background: #ffffff url("img_tree.png") no-repeat right top; margin-right: 200px; } </style> </head> <body> <h1>The background Property</h1> <p>The background property is a shorthand property for specifying all the background properties in one declaration.</p> <p>Here, the background image is only shown once, and it is also positioned in the top-right corner.</p> <p>We have also added a right margin, so that the text will not write over the background image.</p> </body> </html>