Is this html tag well formatted
Our design department gave me a code to add to a page and I am kind o开发者_如何学Gof new to the design part of it and stuff... but is this a valid tag and what does it mean <--if subcontent add rel="test1"-->. Is this somthing that I can just leave like that (it is evaluating correctly as it is) or do I actually need to do something so that that part does something?
<li class="test1"><a href="" <!-- if subcontent add rel="test1" -->>test 1</a></li>
You can use the W3 validation service to determine whether your html is valid. This tests entire pages, not single lines.
http://validator.w3.org/
the browser may display correctly, but the w3c says it's invalid the right way must be:
<li class="test1">
<!-- if subcontent add rel="test1" to the anchor ie:<a rel="text"> -->
<a href="#">test 1</a>
</li>
Are you asking what the <!-- -->
tags are? If so they are html
comments it probably shouldn't be left inside the a
tag.
Absolutely not. The correct version would have the comment outside of the a tag:
<li class="test1"><a href=""><!-- if subcontent add rel="test1" -->test 1</a></li>
this looks like an HTML comment!
Anything within <!-- -->
are comments and are compleatly ignored by the browser. Its for human use only. Have a look here at what the rel tag does
精彩评论