4 Replies Latest reply on Mar 7, 2010 9:57 AM by jonboy0000

    can I replace "@charset "utf-8" ;" with "@charset: utf-8;" ??

    jonboy0000 Level 1

      I get a validation error when I use the default --- @charset "utf-8" --- in my stylesheet. I replaced it with --- @charset: utf-8; --- and it doesn't seem to affect any of the html's, so I assume it's okay. Anyone know for sure?

        • 1. Re: can I replace "@charset "utf-8" ;" with "@charset: utf-8;" ??
          David_Powers Adobe Community Professional

          jonboy0000 wrote:

           

          I get a validation error when I use the default --- @charset "utf-8" --- in my stylesheet.

          I have just tested the following in the W3C CSS Validator:

           

          @charset "utf-8";
          /* CSS Document */
          
          body {
               background-color:#fff;
               color:#000;
               font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
          }
          

           

          It validated perfectly. I then removed the quotes around utf-8, and validated the page again. It failed.

           

          The @charset declaration must be at the beginning of the style sheet. I cannot be anywhere else. It's not the quotes that are causing your styles to fail validation, but something else. Without seeing an example of your styles, it's impossible to say what the problem might be.

          • 2. Re: can I replace "@charset "utf-8" ;" with "@charset: utf-8;" ??
            jonboy0000 Level 1

            My stylesheet starts off:

             

            ---

             

            @charset "utf-8";

             

            html,

            body {

            margin:0;

            padding:0;

            height:100%;

            }

             

            ---

             

            In DW CS3, I "validate current document" and I get the following error in line 1 (actually, 2 errors but they say the same thing):

            "Quotation mark found between tags, HTML documents should not contain these values. Consider using " instead"

             

            I posted this question before and was told I can just ignore the problem, but it just seems odd that if it is in fact a validation error, why would it start off a .css file by default?

             

            Still new to html and all of this, so maybe I'm just missing something simple. Thanks for the help!

             

            ***I just noticed it says "html documents should not contain these values," but a stylesheet isn't an html, is it? So I guess I probably can just ignore it..

            • 3. Re: can I replace "@charset "utf-8" ;" with "@charset: utf-8;" ??
              David_Powers Adobe Community Professional

              jonboy0000 wrote:

               

              In DW CS3, I "validate current document" and I get the following error in line 1

              Validate Current Document is for (X)HTML pages only.

              • 4. Re: can I replace "@charset "utf-8" ;" with "@charset: utf-8;" ??
                jonboy0000 Level 1

                Ah, okay. Thanks for the clarification. So how are stylesheets validated?