为什么这个 CSS 给出验证错误?
Why is this CSS giving a validation error?
CSS代码是:
li.block1 img {
display: block;
margin: 0 auto 0 auto;
}
我试过删除 li 并使其成为 .block img。我试过删除 img 并且只有 li.block。我尝试将块更改为块 1。我什至尝试将 margin: 0 auto 0 auto
更改为 margin: auto
。没有什么改变。 CSS 验证器 returns 错误“解析错误 [ ]”。它甚至没有告诉我错误是什么,也没有告诉我有问题的代码。我检查了文档,看那里是否有一些不正常的不显示字符,并且有none。如果我删除整段样式代码,错误就会消失。
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>
我该怎么做才能解决这个问题?
右大括号后有一个“gremlin”,一个不可见的字符。删除它并验证正常。
对你说几句话。
您在 css 中调用 li,但在 html 中调用 LI...只是不同
右大括号末尾有一个看不见的字符U+200B,删除它。您可以在此处查看隐形字符:https://www.soscisurvey.de/tools/view-chars.php
相当于说
margin: 0 auto 0 auto;
是
margin: 0 auto;
CSS代码是:
li.block1 img {
display: block;
margin: 0 auto 0 auto;
}
我试过删除 li 并使其成为 .block img。我试过删除 img 并且只有 li.block。我尝试将块更改为块 1。我什至尝试将 margin: 0 auto 0 auto
更改为 margin: auto
。没有什么改变。 CSS 验证器 returns 错误“解析错误 [ ]”。它甚至没有告诉我错误是什么,也没有告诉我有问题的代码。我检查了文档,看那里是否有一些不正常的不显示字符,并且有none。如果我删除整段样式代码,错误就会消失。
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>
我该怎么做才能解决这个问题?
右大括号后有一个“gremlin”,一个不可见的字符。删除它并验证正常。
对你说几句话。
您在 css 中调用 li,但在 html 中调用 LI...只是不同
右大括号末尾有一个看不见的字符U+200B,删除它。您可以在此处查看隐形字符:https://www.soscisurvey.de/tools/view-chars.php
相当于说
margin: 0 auto 0 auto;
是
margin: 0 auto;