Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Odd Error from W3C CSS Validator

1,332 views
Skip to first unread message

Rhino

unread,
Dec 18, 2011, 9:15:34 AM12/18/11
to
I'm getting an odd error from the W3C CSS Validator and wonder if anyone
here can clue me in.

This is the error:
0 Parse Error Lexical error at line 1, column 3. Encountered: "D" (68),
after : "<!"

It's the only error that it is seeing but I can't make head nor tails of
what the problem is. There was initially a letter 'd' at the third position
on the first line when I submitted the CSS but it was lower case, not upper
case. It was simply the selector 'body' and I can't see any reason why that
would be a problem. The sequence "<!" doesn't occur anywhere in the CSS
file.

I added some comments and blank lines ahead of that first line in later
submissions but the error doesn't go away and the position of the error is
still given as line 1, column 3.

Here is the entire CSS. Perhaps one of you can see what the validator is
griping about? I was suspecting some kind of quirk with the validator itself
but I can successfully validate very similar CSS from other websites I've
done so that pretty much lets the validator off the hook. But I'm darned if
I can see why it doesn't like the CSS below.

==========================================
/* Link in HTML to stylesheet */
/* <LINK rel="stylesheet" TYPE="text/css"
HREF="http://example.com/Foo/css/sfl.css" media="screen"> */
/* --OR-- */
/* <LINK rel="stylesheet" TYPE="text/css" HREF="css/main.css"
media="screen"> */
/* --OR-- */
/* <LINK rel="stylesheet" TYPE="text/css" HREF="main.css" media="screen"> */

/* @import
url("http://example.com/css/tabsHorzGif/SlidingDoors/tabs_horz.Bisque.css")
screen; */

/* Style Sheet for video displays */

body {
color:#333333;
background-color: #F1F2F3;
font:14px Arial,Helvetica,Sans-serif;
margin:1px 0 0;
padding:0;
text-align:center;
}
a {
color:#777777;
}
a:hover {
color:#A77749;
}
em {
font-weight: 900;
}
img {
margin: 0;
}
.bordered {
border: medium inset #FFF;
}
.centered {
display: block;
margin-left: auto;
margin-right: auto;
}
#container {
background-color: #FF0000; /* must be red to keep bottom part of index
red */
margin:auto;
padding:0;
position:relative;
text-align:left;
width:700px;
}
#logo {
background:url("../images/Foo_logo_700x80.png") no-repeat scroll 0 0
#FFFFFF;
height:80px;
margin:0;
padding:0;
width:700px;
}
#logo h1, h2 {
display:none;
margin:0;
padding:0;
}
#notices {
background:none repeat scroll 0 0;
border-top:1px solid #FFFFFF;
height:75px;
margin:0;
padding:0;
position:relative;
width:700px;
}
#notices p {
margin:0;
padding:0;
}
#notices .p1 {
background:url("../images/my_logo_449x75.png") no-repeat scroll 251px 0
#FFFFFF;
height:75px;
left:0;
position:absolute;
top:0;
width:700px;
}
#notices .p1 span {
display:none;
}
#notices .p2 {
background:url("../images/Foo_Help_250x75.png") no-repeat scroll 0 0
#FFFFFF;
height:75px;
left:0;
position:absolute;
top:0;
width:250px;
}
#notices .p2 span {
visibility:hidden; /* if value is hidden, text is invisible */
white-space:nowrap;
}
#notices .p2 a {
float:right;
height:37px;
margin-bottom:1.4em;
margin-top:-1.3em;
overflow:hidden;
text-indent:-9000px;
visibility:visible;
width:250px;
}
#mainContent {
background:url("../images/mainContent_top.gif") no-repeat scroll left
top #CCCCCC;
border-top:1px solid #FFFFFF;
border-right: 1px solid #FFFFFF;
border-bottom: 0;
margin:0;
padding:0;
position:relative;
width:524px;
}
#mainContent .p1 {
margin:0;
padding:31px 15px 0;
}
#mainContent p {
margin:25px;
padding:10px 15px 0;
}

#mainContent .p3 {
margin:0;
padding:10px 15px 7px;
}
#mainContent h1 {
margin: 15px;
font-size: 175%;
}
#mainContent h2 {
margin: 15px;
font-size: 150%;
}
#mainContent h3 {
margin: 15px;
font-size: 125%;
}
#supportingText { /* embeds footer */
width:524px;
}
#footer {
background:url("../images/footer_top.gif") no-repeat scroll left top
#FF0000;
border-right: 1px solid #FFFFFF;
padding-left:15px;
padding-top:17px;
}
#linkList {
background:none repeat scroll 0 0 #FF0000;
border-top:1px solid #FFFFFF;
color:#FFFFFF;
left:525px;
position:absolute;
top:156px;
width:175px;
}
#linkList h3, #linkList h4 {
padding-left: 5px;
}
#linkList a, #footer a {
color:#FFFFFF;
text-decoration:none;
}
#linkList a:hover, #footer a:hover {
color:#FCD2B8;
}
#menu {
background:url("../images/linksInternal_top.gif") no-repeat scroll left
top #FF0000;
padding:10px 0 0;
}
#menu ul {
margin:0;
padding:0 15px 5px;
}
#menu li {
background:url("../images/bullet2.gif") no-repeat scroll 0 4px
transparent;
list-style-type:none;
margin:0;
padding:0 0 5px 15px;
}
#menu h3 {
/* display:none; */
}

#bottom {
background: url("../images/bottom.gif") no-repeat scroll left top
#FFFFFF;
height: 9px;
margin: auto;
width: 700px;
}

#last-update {
top: 0;
left: 0;
border-top: 1px ridge transparent;
border-right: 1px solid #FFFFFF;
padding: 0;
margin: 0;
background-color: #CCCCCC;
width: 524px;
height: 20px;
}
p.last-update-timestamp {
font-size: smaller;
text-align: left;
padding-left: 5px;
}


========================================

--
Rhino

Rob W

unread,
Dec 18, 2011, 9:25:50 AM12/18/11
to
Op 18-12-2011 15:15, Rhino schreef:
> I'm getting an odd error from the W3C CSS Validator and wonder if anyone
> here can clue me in.
>
> This is the error:
> 0 Parse Error Lexical error at line 1, column 3. Encountered: "D" (68),
> after : "<!"
>
> It's the only error that it is seeing but I can't make head nor tails of
> what the problem is. There was initially a letter 'd' at the third
> position on the first line when I submitted the CSS but it was lower
> case, not upper case. It was simply the selector 'body' and I can't see
> any reason why that would be a problem. The sequence "<!" doesn't occur
> anywhere in the CSS file.
>
[css snipped]


Given all the mysteries, it might be better if you supply us with a URL
tot the real site.

--
RW

Jukka K. Korpela

unread,
Dec 18, 2011, 10:00:05 AM12/18/11
to
2011-12-18 16:15, Rhino wrote:

> I'm getting an odd error from the W3C CSS Validator and wonder if anyone
> here can clue me in.
>
> This is the error:
> 0 Parse Error Lexical error at line 1, column 3. Encountered: "D" (68),
> after : "<!"

You have apparently submitted an HTML document to the W3C CSS Validator.
While that usualy works when submitting "By URI" or "By file upload"
(the software first runs an HTML parser when needed, then checks the
included and referenced stylesheets), it does not work "By direct input"
- there content must be CSS. Neither does it work when submitting an
HTML document declared as a stylesheet

> The sequence "<!" doesn't occur
> anywhere in the CSS file.

You should really have posted the URL. Then it would be easy to check
whether the data contains "<!" or not.

When I submit the exact contents between the lines with equals sign, the
W3C CSS Validator says "Congratulations! No Error Found."

> Here is the entire CSS.

It's hardly the entire CSS.

Here's the scenario. You have a file with that exact content, and you
have uploaded it somewhere, then submitted the URL. But there's a
naughty server involved, and it inserts a <!DOCTYPE HTML> or something
like that at the start of the data. Yet the data is sent declared as
text/css.

Do you now see the importance of posting a URL?

--
Yucca, http://www.cs.tut.fi/~jkorpela/

tlvp

unread,
Dec 18, 2011, 1:50:32 PM12/18/11
to
On Sun, 18 Dec 2011 09:15:34 -0500, Rhino wrote:

> I'm getting an odd error from the W3C CSS Validator and wonder if anyone
> here can clue me in.
>
> This is the error:
> 0 Parse Error Lexical error at line 1, column 3. Encountered: "D" (68),
> after : "<!"

Sure makes me think some w3 programmer had prepared an error message having
to do with an initial */<!DOCTYPE ... /* declaration, that somehow left
the HTML-validation area, to enter into the CSS-validation area, and act up
all gremlin-y there :-) .

HTH (though, realistically, it probably won't); and cheers, -- tlvp
--
Avant de repondre, jeter la poubelle, SVP.

Rhino

unread,
Dec 18, 2011, 1:59:56 PM12/18/11
to

"Jukka K. Korpela" <jkor...@cs.tut.fi> wrote in message
news:jckv5l$v6f$1...@dont-email.me...
Thanks for your assistance - and that of Rob W - in sorting out my problem.
As I suspected and your remarks reinforced, the problem occurred as a result
of the way the CSS was submitted to the validator, not due to an error in
the CSS as such.

I have this - <a
href="http://jigsaw.w3.org/css-validator/check/referer"><img class="noprint
unbordered" src="http://www.w3.org/Icons/valid-css2.png" alt="Valid CSS2!"
height="31" width="88"/></a> - at the bottom of each of my pages and this
form of submission was causing the error I mentioned - but only on one
server.

Since this HTML was copied from another website I did on the same server, I
assumed it should work perfectly in the new site I'm building. However, when
I tried submitting the CSS via a URL at the validator site, I got the same
error when I had it look at my new CSS and no errors at all when I had it
look at the older CSS I was using as a model. In both cases, I was using the
same server. The only difference was that there was an extra level in the
URL:
- example.com/index.shtml, which validated fine
- example.com/Foo/index.shtml, which gave the error

When I moved the new code to a different server, my "referer" links worked
fine.

Clearly, there is something not quite right on the server that held the old
and the new sites; introducing another level in the path seems to mess it up
somehow with regards to CSS validation. But I wanted the new site on the
different server anyway so everything is working fine now.

Thanks again to both of you.

--
Rhino

kats...@gmail.com

unread,
Jun 28, 2014, 3:16:00 AM6/28/14
to
Its a file encoding problem with hidden chars. Check image here http://katsarov.biz/post-14/w3c-lexical-error-at-line-fix

Jukka K. Korpela

unread,
Jun 28, 2014, 3:00:06 PM6/28/14
to
2014-06-28 10:16, kats...@gmail.com wrote:

> Its

What?

> a file encoding problem with hidden chars.

Are you answering some unspecified question, or what?

> Check image here

Don't be ridiculous. If you have a problem with CSS code, post the code
or a URL that points to the code. Actually, when you suspect encoding
problem, the URL (for the code) is almost always the only way to tell
what the problem is. We need it to see the HTTP headers, among other things.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Christoph Michael Becker

unread,
Jul 1, 2014, 6:41:26 PM7/1/14
to
It seems to me that wasn't a support request, but rather a (spam) link
to the guy's blog post.

--
Christoph M. Becker
0 new messages