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?
Who is Participating?
RouchieConnect With a Mentor Commented:
Can you give me an example of your code so I might try and modify it?  If you use Master Pages (which I recommend) you can link all the CSS files directly into the <head> element and these will be automatically available to all pages using that Master Page.

  <title>My Page</title>
  <link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
  <link rel="stylesheet" type="text/css" media="print" href="print.css" />

Open in new window

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.
JeReLoAuthor Commented:
Ok I pasted it in directly, and it gives this error:
a:visited Parse Error - [empty string]

But the actual css has this entry:
        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.
JeReLoAuthor Commented:
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.