Log in

View Full Version : layer-background-color question



marain
07-31-2012, 12:56 AM
A moderator pointed out a css error in the following code:

[CODE]

<style type="text/css">
.intro{
position:absolute;
left:0;
top:0;
layer-background-color:#ffff00;

/* #ffff00 = yellow */

background-color:black;
border:8.0px solid blue;
z-index:10;
}
</style>

[CODE]

Acting on his suggestion, I will be eliminating the layer-background-color line (not w3c approved), and substituting w3c-approved background-color: #ffff00; in the background-color line. So far, so good. But verily one thing puzzles me: The background on the page in question displayed as yellow (which is happens to be the color I wanted). However, the w3c-accepted parameter specified "black". Further, the background-color line * followed * the layer-background-color line. Given those facts, I do not understand why the background color actually displayed the yellow that I wanted, rather than black. And this was so both in Firefox and Explorer.

A.

bernie1227
08-01-2012, 08:37 AM
Well what happens when you take layer-background-color out? Personally, I've never come across this CSS rule, but as a guess, Id say that the layer-ackground-color is higher and therefore on to of the background-color.

jscheuer1
08-01-2012, 05:02 PM
As I explained when I pointed this out, the reason it doesn't affect the page background is that the selector:



.intro

appears nowhere in the markup of the page.

Because of that, I suggested that the entire section:


<style type="text/css">
.intro{
position:absolute;
left:0;
top:0;
layer-background-color:#ffff00;

/* #ffff00 = yellow */

background-color:black;
border:8.0px solid blue;
z-index:10;
}
</style>

could be removed.

The only reasons for updating it to standards and keeping it would be if it's also used on another page with a class="intro" element, or if there's a possibility that a class="intro" element will be added to the page later.

As further explanation, the layer-background-color property was required for very early Netscape browsers. No browser that requires that is in use today. If it were, it would have many more problems in rendering the typical modern web page than getting the background color right.