Jump to content

CSS Validation Question


SmokingMan

Recommended Posts

I ran the W3C Validator on my CSS and it validates, but with three warnings. I don't quite understand them, so I thought I'd post them along with my CSS so someone can maybe 'splain them to me.Here is my CSS:

/*	Meadow Muffin Stylesheet */body	{background-image: url(images/pastel-bg.gif); background-color:  white;}.main	{width: 100%; height: auto; margin: auto;}	/* main page container */.header	{width: 600px; margin: auto; height: auto; position: relative;}	/* site banner */.nav	{width:100%; position: relative; height: auto;}	/* navbar block */.content	{width: 100%; height: auto; position: relative;}	/* page text and image content */.maincontent	{width: 90%; position: relative; height: auto; left: 5%;}	/* main page content */.footer  {width: 100%; height: auto; clear: both;}	/* page bottom, banners and stuff */.mainfont	{font-family:arial,  serif; font-size:90%; font-style: italic; text-align: justify; color: maroon;}	/* main page font */.randomimage	{padding-left: 10px; padding-bottom: 10px; padding-top: 10px; float: right;}	/* random image properties */

Here are the warnings I got:

Line : 3 (Level : 1) You have no color with your background-color : body Line : 17 (Level : 1) This property applies to block-level elements. : .mainfont Line : 17 (Level : 1) You have no background-color with your color : .mainfont
I have a background color with my body declaration. And what do the warnings from Line 17 mean. I'm at a loss.
Link to comment
Share on other sites

It's a W3C reccomendation to use background-color and color together to ensure a text is always visible. Simply add "color: black;" to body and "background-color:inherit;" to .mainfont.I'm not sure about the second waring though. I don't know to which CSS property it refers to. Place your CSS properties on different lines and you are sure to see.

Link to comment
Share on other sites

text-align:justify seems to be the only property to fit the warning.Does it actually justify the text even though it is not a block level element???You could add display:block to .mainfont

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
×
×
  • Create New...