tomsseisums
tomsseisums

Reputation: 13357

Tag usage within links/anchors

Which of the examples is considered to be semantically correct?

  1. <a href="http://example.com/"><strong>Example</strong></a>
  2. <strong><a href="http://example.com/">Example</a></strong>

Of course applies to any other formatting tag like <u>, <em> etc.

Upvotes: 0

Views: 44

Answers (2)

Tim
Tim

Reputation: 9489

Both are correct. both are inline elements which can contain other inline elements (except there own tag) <strong><strong></strong></strong> is incorrect but any of this list can be used inside of each other.

Upvotes: 1

Harmen
Harmen

Reputation: 22438

Both are; both elements are inline elements.

Upvotes: 1

Related Questions