0

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:

body{
        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!
Key

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by kroche
2

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.

0

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
css2
http://jigsaw.w3.org/css-validator/validator?profile=css21&usermedium=all&warning=1&lang=en&uri=http%3A%2F%2Fwww.yoursite.com
css3
http://jigsaw.w3.org/css-validator/validator?profile=css3&usermedium=all&warning=1&lang=en&uri=http%3A%2F%2Fwww.yoursite.com

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

0

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.