Previous | Home | Next |
In the html background color is white (by default) and there are two ways to used in webpage background.
- By color on html background
- By image to use html background
It is control of HTML element by bgcolor attribute to show the web page body and table backgrounds.i In the bgcolor attribute with any HTML tag.
Syntax used<tagname bg color="color_value"...>
There are three types of formate of HTML Background with colors
<!-- Format 1 - Use color name --> <table bgcolor="green" > <!-- Format 2 - Use hex value --> <table bgcolor="#f1f1f1" > <!-- Format 3 - Use color value in RGB terms --> <table bgcolor="rgb(0,0,120)" >
Example HTML Background with colors
<!DOCTYPE html> <html> <head> <title>HTML Background Colors</title> </head> <body> <!-- Format 1 - Use color name --> <table bgcolor="yellow" width="50%"> <tr><td> This background is yellow </td></tr> </table> <!-- Format 2 - Use hex value --> <table bgcolor="#6666FF" width="50%"> <tr><td> This background is sky blue </td></tr> </table> <!-- Format 3 - Use color value in RGB terms --> <table bgcolor="rgb(255,0,255)" width="50%"> <tr><td> This background is green </td></tr> </table> </body> </html>
Output :
It can be use to background attribute for control the background of html page body and table backgrounds. Background attribute is use style sheet for background setting and iamge formats are JPEG .
Syntax used
<tagname background="Image URL"...>
Example HTML Background with Images
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Images</title>
</head>
<body>
<!-- Set table background -->
<table background="../../../xampp/htdocs/
r4r_advance/images/background1.gif" width="260" height="194"></p>
<tr><td>
<br>
Example with HTML image.
</br>
</td></tr>
</table>
</body>
</html
Output :
Previous | Home | Next |