show-notice
hide-notice

Wednesday 7 August 2013

CSS bgcolor


Introduction:

You may be familiar with the old HTML bgcolor attribute. This attribute (which was deprecated in HTML 4 and has been discontinued as of HTML 5) allowed you to set the background color of HTML elements. For example, using that attribute, you could set the background color of elements such as the <table> element or the <body> element.


Although there is no CSS bgcolor property or attribute, there is the CSS background-color property. The background-color property is the CSS equivalent to the old HTML bgcolor attribute. Actually, the CSS background-color property is more powerful than the HTML bgcolor attribute. One major advantage of the background-color property is that it can be applied to any element.

Example:
<html>
<head>
<title></title>
</head>
<body>
<div style="width:150px;height:100px;padding:5px;background-color:limegreen;color:green;border:1px solid black;">
<p>CSS background color example.</p>
</div>
</body>
</html>

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com