kjkjl
kjkjl

Reputation: 147

Html anchor tag

Do I need to wrap a tag (a href="#") in a <p> tag? I guess it can be wrapped in any block level element like div but I'm not sure.

Upvotes: 2

Views: 1018

Answers (2)

James Jeffery
James Jeffery

Reputation: 12599

No. If you want to make the anchor element block level you use the css property display: block;

<a href="http://www.google.com/mail" title="Google Web Mail" style="display: block;">Google Mail</a>

You can wrap an anchor in a p element if you want to do something like:

<p>My favorite search engine is <a href="http://www.google.com" title="Google Search Engine">Google</a>, because it allows me to fine tune my search</p>

Upvotes: 1

user151323
user151323

Reputation:

It is an inline element and doesn't have to be wrapped anywhere.

The page body is already a block-level element, so anything you have inside it is respectively wrapped by it.

Upvotes: 4

Related Questions