Jump to content

Quick Question


The Praetorian
 Share

Recommended Posts

Which is the proper syntax? They both seem to work, but in case the next version of css rules one or the other out, which one is considered proper?Also! Is there a # for transparent/clear? I'm trying to get my css down to a perfect validation.. but it keeps telling me I have no background-color with certain elements, where I've put "background-color: transparent". It also gave me the same error four times for an element that only appears once. Is there a bug in the validator?

Link to comment
Share on other sites

background: or background-color: are both accepted. background: is just a shorthand property for all the background properties.http://www.w3schools.com/css/css_background.aspTo get a valid (no warnings) transparent css background-color, you should use background-color: inherit. This way, it inherits the background from the parent element, but just the part that is within its own positioning at the time. However, if you use positioning on your site, you may have trouble. I've seen incidents where it inherits the background of the position it should have been. If it is an image, this looks weird, because you get one part of the background image over again.As for your error coming up four times with only one incident of the element, are you sure you're reading it right? It could be info like:"It starts here""It ends here"etc.etc.Some are marked [ ERROR ], some are marked [ INFO ] in the validator.

Link to comment
Share on other sites

Hm. Well, I can't use inherit, because I use an image as my background. If I use inherit, then the background of the elements becomes black and obscures the background image.As for the rest, my css does validate. And they are warnings, not errors. This is what it reads. * Line : 15 (Level : 1) You have no background-color with your color : a * Line : 26 (Level : 1) You have no background-color with your color : h4 * Line : 26 (Level : 1) You have no background-color with your color : h4 * Line : 26 (Level : 1) You have no background-color with your color : h4 * Line : 26 (Level : 1) You have no background-color with your color : h4 * Line : 29 (Level : 1) This property applies to block-level elements. : h4 * Line : 29 (Level : 1) This property applies to block-level elements. : h4 * Line : 29 (Level : 1) This property applies to block-level elements. : h4 * Line : 29 (Level : 1) This property applies to block-level elements. : h4 * Line : 37 (Level : 1) This property applies to block-level elements. : p * Line : 44 (Level : 1) This property applies to block-level elements. : *.news * Line : 52 (Level : 1) This property applies to block-level elements. : div.banner * Line : 61 (Level : 1) You have no color with your background-color : div.banner * Line : 68 font-family: You are encouraged to offer a generic family as a last alternative * Line : 68 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : div.banner p * Line : 73 (Level : 1) This property applies to block-level elements. : div.banner p * Line : 79 (Level : 1) You have no color with your background-color : div.banner a * Line : 98 (Level : 1) You have no color with your background-color : div.banner a * Line : 107 (Level : 1) You have no color with your background-color : div.banner a:hoverAnd just so you can compare, here's the link to my css.My CSS

Link to comment
Share on other sites

I fixed it. I still don't know why the same error popped up four times.. but I went through and fixed it. Turns out I needed to define the color of the element as well as its background color. And for some reason, that Font family warning doesn't count Times as a default font. It wouldn't go away until I added serif in there too. Very odd. Thanks for the help though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...