Search code examples
cssvalidationhidden-characters

Why is this CSS giving a validation error?


The CSS code is:

li.block1 img {
    display: block;
    margin: 0 auto 0 auto;
}​

I have tried removing the li and making it .block img. I have tried removing img and only having li.block. I tried changing block to block1. I even tried changing margin: 0 auto 0 auto to just margin: auto. Nothing changes. The CSS validator returns the error "Parse Error [ ]". It doesn't even tell me what the error is or show me the offending code. I have checked the document to see if there is some unusual non-displayed character there, and there is none. The error disappears if I remove this entire piece of the style code.

The HTML part doesn't have any issue at all.

Here is the entire STYLE block:

<STYLE>
  body {
    background-color: #103872;
    color:lightseagreen;
    font-family:verdana;
  }
  a:link {
    color:seagreen;
    text-decoration:none;
  }
  a:visited {
    color:seagreen;
  }
  a:hover {
    color:seagreen;
  }
  a:active {
    color:seagreen;
  }
  p {
    text-align:justify;
  }
  li.block1 img {
    display: block;
    margin: 0 auto 0 auto;
  }​
</STYLE>

Edit: Here's the HTML that uses this code.

<LI class="block1">If everything goes well, you will get this when the installation is complete: <IMG style="padding-top:10px; padding-bottom:10px; height:50%; width:50%" src="Images/complete.png" alt="Installation Complete image"></LI>

What do I do to fix this?


Solution

  • There's a "gremlin", an invisible character, after the closing brace. Delete that and it validates fine.