Hello There!
I am building a dynamic CSS document through PHP and was wondering if it is a big problem (for browsers or SEO or something) for me to leave blank values for some CSS attributes. If it is problematic, is it so much so that it is worth adding a lot more server-side code to make sure I don't leave any attributes blank.

Here is an example of what I am thinking of doing:

        background: #00FF00 url();
        color: ;

So in that example is it a problem that there is no value for color and no value for the background URL?

Thanks in advance!

5 Years
Discussion Span
Last Post by kroche

Certainly older versions of Internet Explorer will choke on CSS declarations without a value. Other browsers may encounter issues too.

The SEO of a site should have nothing to do with CSS. As far as I am aware, it's only the HTML markup that is considered - e.g. semantics, etc.

Someone, please correct me if I am wrong.

Depending how you've built your application, it shouldn't require much more code (one or two lines) to exclude CSS declarations that do not have a value.


It is not a seo issue, but it may cause many, if not most, browsers to fail to display the page, and ruin visitor retention
run the generated page through the css validators

replace yoursite.com with a uri to the generated page, and see how bad/good the result is


Thanks for your replies! I suppose it would be best to stay on the safe side and just check if they are blank and not output that attribute. IE ruines everything :\ lol

Thanks again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.