为什么“< ;! - “注释一个样式规则,但是“<! - 才不是? [英] Why does "<! --" comment out a style rule, but "<!--" does not?
问题描述
轻易就可以了。我只是在学习HTML。
加入 http://www.w3.org/TR/html-markup/syntax.html#comments 以及我见过的许多其他网站,例如 http://www.w3schools.com/tags/tag_comment.asp
他们说HTML评论是 然而,我在下面显示,只有当我写 这里是HTML代码 现在运行它之前,表格是否有边框? 如果text / css中的内容真的被注释掉,那么表格不应该有边框,对吧?但它是。我试过这个在chrome版本24.0.1312.52下linux薄荷14,还火狐18.0 现在当我改变到 注意额外的空间。然后,表格显示没有预期的边框。当我实际删除整行时也是如此: 问题:注释 CSS不接受HTML Take it easy on me. I am just learning HTML. Accroding to http://www.w3.org/TR/html-markup/syntax.html#comments and many other sites I've seen such as this http://www.w3schools.com/tags/tag_comment.asp they say an HTML comment is Yet, I show below that only when I write Here is the HTML code Now before you run it, should the table have border or not? If the stuff in text/css is really commented out, then the table should not have border, right? But it does. I tried this on chrome Version 24.0.1312.52 under linux mint 14, and also firefox 18.0 Now when I change the line to Notice the extra space now. Then the table shows up with no border as expected. The same happens when I actually delete the whole line: question is: Is the comment CSS doesn't accept HTML 这篇关于为什么“< ;! - “注释一个样式规则,但是“<! - 才不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!与下一个破折号之间没有空格的
<! - text - >
b
$ b <! - test - >
是内部的东西实际上被忽略。注意<!
和 -
<!DOCTYPE HTML>
< html>
< head>
< style type =text / css>
<! - td {border:1px solid gray;} - >
< / style>
< / head>
< body>
< table>
< tr> < td> test< / td> < / tr>
< / table>
< / body>
< / html>
< ;! - td {border:1px solid gray;} - >
<!DOCTYPE HTML>
< html>
< head>
< style type =text / css>
< / style>
< / head>
< body>
< table>
< tr> < td> test< / td> < / tr>
< / table>
< / body>
< / html>
! - text - >
或者是< ;! - text - >
?<! - comment here - >
注释。相反,CSS使用 / * comment * /
来注释行。试试。<!-- text -->
with no space between !
and the next dash.<! -- test -->
is the stuff inside be actually gets ignored. Notice the space added between <!
and --
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
<!-- td {border: 1px solid gray;} -->
</style>
</head>
<body>
<table>
<tr> <td> test </td> </tr>
</table>
</body>
</html>
<! -- td {border: 1px solid gray;} -->
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<table>
<tr> <td> test </td> </tr>
</table>
</body>
</html>
<!-- text -->
or is it <! -- text -->
?<!-- comment here -->
comments. Instead CSS uses /* comment */
to comment lines. Try that instead.