user710502
user710502

Reputation: 11471

Is this html tag well formatted

Our design department gave me a code to add to a page and I am kind of 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>

Upvotes: 3

Views: 106

Answers (6)

Lucho Giribone
Lucho Giribone

Reputation: 258

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>

Upvotes: 2

Phil
Phil

Reputation: 11175

Are you asking what the <!-- --> tags are? If so they are html comments it probably shouldn't be left inside the a tag.

Upvotes: 2

Tom Squires
Tom Squires

Reputation: 9286

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

Upvotes: 1

enthus1ast
enthus1ast

Reputation: 2109

this looks like an HTML comment!

Upvotes: 1

BenGC
BenGC

Reputation: 2854

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>

Upvotes: 1

mrtsherman
mrtsherman

Reputation: 39872

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/

Upvotes: 4

Related Questions