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?
JeReLoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RouchieCommented:
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.
0
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:
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!

0
RouchieCommented:
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.
0
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?
0
RouchieCommented:
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.

e.g.
<head>
  <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" />
</head>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.