Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Expertise: Intermediate
Nov 17, 1998

Setting Layer/DIV Background Colors

Often it is desirable to set a background color for an entire layer or DIV region, much like setting the background color for a whole table. Setting a layer background color should work the same for version 4 of both Netscape and Internet Explorer but it doesn't. The Cascading Style Sheet (CSS) background-color:color sets the background color in Internet Explorer, but only colors the background of text in Netscape 4. To get the same effect in both browsers, use two tags in sequence: background-color:color for Internet Explorer and layer-background-color:color for Netscape. For example:
<div id="photolayer" style="z-index: 1; left: 5px; top: 50px; width: 530px; 
height: 370px; background-color:#003366; layer-background-color:#003366; visibility: visible"> 
Erik Goetze
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.