Link to home
Start Free TrialLog in
Avatar of JeReLo
JeReLo

asked on

CSS validation error on @media screen {H1{}} - how to correct?

I ran the CSS validation (from www.w3csites.com) on my site, and it generates the following error:

Parse Error - ýýý@media screen { H1 { font-size: 16pt; color: #2c2d67; font-family: 'Lucida Sans'; } H2 { font-size: 16pt; color: #003399; font-family: 'Microsoft Sans Serif'; text-align: center; } H3 { font-size: 14pt; color: #599DC6; font-family: Arial, Helvetica, sans-serif; } ...}

it continues on till the end of the @media screen section, but then finds the @media print section to be fine, even though it is structured in the same way.

The site was made in Visual Studio 2008, and the style sheet seems to work correctly. Is there some kind of preface it's expecting, or what is wrong. How can I correct my style sheet so it passes validation?
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Try the W3C validator directly: http://jigsaw.w3.org/css-validator/

It might be a UTF encoding issue within your file.  If the W3C validator fails to parse the file, paste the CSS code directly into the Direct Input form field.
Avatar of JeReLo
JeReLo

ASKER

Ok I pasted it in directly, and it gives this error:
a:visited Parse Error - [empty string]

But the actual css has this entry:
a:visited
    {
        background: transparent;
        color: #464295;
        font-weight: bold;
        text-decoration: none;
        border-bottom: 1px #000 solid;
        padding-bottom: 2px;
    }
 
If you're able to see what I mean, you can try it with the site http://view.servehttp.com

Strangely, their site provides a broken link to a forum for help!

If I copy and paste the text out of the CSS file into the Direct Input field in the validator then I don't get the error.

If I enter the CSS file's URL into the validator then I do get the Parse error.  It seems that the validator doesn't like the different @media types all in the same CSS file.  I would separate each media type and put each one in it's own seperate file, then reference each one separately from within the html pages.
Avatar of JeReLo

ASKER

In some further investigation elsewhere, it was determined that it can accept the various @media settings, but it might be having a problem with the length of the file.
Can you tell me how to reference multiple css files in visual studio 2008? Currently I use the page setting in the web.config file. The plan is to break the css file into several parts, but then how would one call them all up again?
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial