CSS Help (easy?)

  • Thread starter skip0110
  • 7 comments
  • 760 views
5,178
United States
Worcester, MA
skip0110
Simple CSS issue:

Why is W3C giving me a warning on the following CSS?


Line : 2 (Level : 1) You have no background-color with your color : .submitLink


Code:
.submitLink {
   color: #00f;
   background-color: transparent;
   text-decoration: underline;
   border: none;
   cursor: pointer;
}

I did specify a background color, transparent!
 
From what I remember, 'transparent' is indeed a valid color value, so I don't think thats the issue (although I usually leave the property out in that case).

The only thing that strikes me is a distinct lack of hex in your color property. Should have 6 parts to it, instead of 3.
 
I thought the 3-digit hex vaules were acceptable, it simple doubles every hex digit, so #00f becomes #0000ff.

In any case, fixing it did not get rid of any errors.
 
Can you not just leave the background-color out all together? Wouldn't that be transparent? Or is it inheriting a coloured background from another element?
 
Can you not just leave the background-color out all together? Wouldn't that be transparent? Or is it inheriting a coloured background from another element?

It is so that a submit button looks like a link. I wanted to avoid using JavaScript. The transparent is to get rid of the button look and leave just the text.

HTML snippet:
HTML:
		<form method="post" action="todo.exe">
			<p>
				Name: <input type="text" name="add" size="20" />
				<input type="submit" value="Add" name="submit" class="submitLink" />
			</p>
		</form>

Or you can look at it at http://168.122.223.250/SC512/cgi-bin/todo.exe, if my machine is up...
 
Well a warning is nothing really to worry about, as it doesn't directly harm the page content or browser compatability. I think it may perhaps be because transparent may not be a colour? Not 100% sure though.
 
Indeed, a warning is not the end of the world &#8211; the code is still valid.
 
Back