0

CSS代码是:

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

我已经尝试删除 li 并使其成为 .block img。我试过删除 img 并且只有 li.block。我尝试将块更改为块1。我什至尝试更改margin: 0 auto 0 auto为 just margin: auto。没有什么变化。CSS 验证器返回错误“Parse Error [ ]”。它甚至没有告诉我错误是什么,也没有告诉我有问题的代码。我检查了文档,看看那里是否有一些不寻常的未显示字符,没有。如果我删除这整个样式代码,错误就会消失。

HTML 部分根本没有任何问题。

这是整个 STYLE 块:

<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>

编辑:这是使用此代码的 HTML。

<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>

我该怎么做才能解决这个问题?

4

2 回答 2

3

在右大括号之后有一个“gremlin”,一个不可见的字符。删除它,它验证正常。

于 2020-09-04T15:06:04.433 回答
2

给你几句话。

您在 css 中调用li但在 html 中说LI ... 只是不同

右大括号末尾有一个不可见字符 U+200B,删除它。您可以在此处查看不可见字符:https ://www.soscisurvey.de/tools/view-chars.php

相当于说

margin: 0 auto 0 auto;

margin: 0 auto;
于 2020-09-04T15:09:21.903 回答