Forum Moderators: not2easy

Message Too Old, No Replies

validating code

no background with color

         

webmstr

1:00 am on Nov 9, 2005 (gmt 0)

10+ Year Member



I don't want a background behind this text because I have a special background that I want to show through. So how can I do this with the code and still get it to validate? The keyword "transparent" doesn't work.
TIA

bedlam

2:15 am on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'd better post a short sample of the code (and maybe the text of the validator error). Either of the following code samples should work:

/* One declaration */
background:transparent url(path/to/image.gif) repeat-x top left;

/* Several declarations */
background-color:transparent;
background-image:url(path/to/image.gif);
background-position:top left;
background-repeat:repeat-x;

-B

webmstr

2:46 am on Nov 9, 2005 (gmt 0)

10+ Year Member



Line : 71 (Level : 1) You have no background-color with your color : .style41
Line : 76 (Level : 1) You have no background-color with your color : .style42
Line : 79 (Level : 1) You have no background-color with your color : .style45
Line : 84 (Level : 1) You have no background-color with your color : .style46

That is the error the validator gives me. And here is my code snippet for that first line to give an example.

.style41 {
font-size: 36px;
color: #003366;
background-color: transparent;
}
.style42 {
font-size: 18px;
color: #003366;
}
.style45 {
color: #003366;
font-family: Arial, Helvetica, sans-serif;
}
.style46 {
font-size: 24px;
color: #003366;
font-family: Arial, Helvetica, sans-serif;
}

so as you see, adding the background color keyword 'transparent' doesn't help a bit. It wants a background color and I need to know how to get past that so that I can have text color and no background.

moltar

2:48 am on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think you can fix those without either setting a bg color or removing text color from the same container. So basically you can have either both of the declarations or none.

bedlam

6:26 am on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Line : 71 (Level : 1) You have no background-color with your color : .style41
Line : 76 (Level : 1) You have no background-color with your color : .style42
Line : 79 (Level : 1) You have no background-color with your color : .style45
Line : 84 (Level : 1) You have no background-color with your color : .style46

That is the error the validator gives me

Look more closely: those are warnings, not errors.

The validator is simply advising you that there is the potential for a problem with the given lines in the stylesheet (i.e. that by not specifying a background color you may accidentally cause some or all of the text styled by the css in question to be unreadable). If you're confident the warning doesn't apply in any particular case, just ignore it.

-B

webmstr

6:30 am on Nov 9, 2005 (gmt 0)

10+ Year Member



ahhhh, ok. Duh...lol. I guess I am just so gung-ho to make sure it is all perfect! Thanks for the tips. I want it to be viewed this way, so I will not worry about it!