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 <!-- text -->
with no space between !
and the next dash.
Yet, I show below that only when I write <! -- test -->
is the stuff inside be actually gets ignored. Notice the space added between <!
and --
Here is the HTML code
<!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>
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
<! -- td {border: 1px solid gray;} -->
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:
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<table>
<tr> <td> test </td> </tr>
</table>
</body>
</html>
question is: Is the comment <!-- text -->
or is it <! -- text -->
?
Comments in CSS can be added by using the /* tag, which is then closed off by using */ . Note: Code that is commented out is not used to style the page. This technique can be used to add both single and multi-line comments.
The /* */ comment syntax is used for both single and multiline comments. There is no other way to specify comments in external style sheets. However, when using the <style> element, you may use <!
The HTML Comment Tag Comments in HTML start with <! -- and end with --> . Don't forget the exclamation mark at the start of the tag! But you don't need to add it at the end.
CSS doesn't accept HTML <!-- comment here -->
comments. Instead CSS uses /* comment */
to comment lines. Try that instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With