35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| title: Body Background Attribute
 | |
| ---
 | |
| 
 | |
| ## Body Background Attribute
 | |
| If you want to add a background image instead of a color, one solution is the `<body background>` attribute. It specifies a background image for an HTML document.
 | |
| 
 | |
| Syntax: 
 | |
| 
 | |
| `<body background="URL">`
 | |
| 
 | |
| 
 | |
| Attribute:
 | |
| 
 | |
| `background - URL for background image`
 | |
| 
 | |
| Example:
 | |
| ```html
 | |
| <html>
 | |
|   <body background="https://assets.digitalocean.com/blog/static/hacktoberfest-is-back/hero.png">
 | |
|   </body>
 | |
| </html>
 | |
| ```
 | |
| 
 | |
| ## body-background attribute is depreciated
 | |
| The body-background attribute has been deprecated in HTML5 and is no longer recommended for use. The correct way to style the ```<body>``` tag is with CSS.
 | |
| 
 | |
| There are several CSS properties used for setting the background of an element. These can be used on the <body> tag to set the background of an entire page.
 | |
| 
 | |
| ## Check it Out:
 | |
| * [CSS background](https://github.com/freeCodeCamp/guides/blob/master/src/pages/css/background/index.md)
 | |
| * [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/background)
 | |
|   
 | |
| 
 |