Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it standard to use Hyperlink(a tag) within label tag?

Is it standard to use a hyperlink (anchor tag) within a label tag?

<label for="ContentPlaceHolder1"><a href="~/address">Link Text and Label Name</a></label> 
like image 528
Mohammad Dayyan Avatar asked Jul 31 '13 07:07

Mohammad Dayyan


People also ask

What is the correct tag for a hyperlink?

The <a> tag defines a hyperlink, which is used to link from one page to another. The most important attribute of the <a> element is the href attribute, which indicates the link's destination.

Can a label be a link?

Labels have no links to view them, so no, you can't provide links to them.

How do you add a link to a label in HTML?

To make a hyperlink in an HTML page, use the <a> and </a> tags, which are the tags used to define the links. The <a> tag indicates where the hyperlink starts and the </a> tag indicates where it ends. Whatever text gets added inside these tags, will work as a hyperlink. Add the URL for the link in the <a href=” ”>.

Which tag is used for labeling?

HTML <label> Tag.


1 Answers

It is valid to have an anchor inside a label — in HTML 4.01 as well as HTML5.

You can try out the W3C Markup Validator to quickly check if your markup is valid.

Whether it makes sense is another question. It is probably ok to have a link alongside with some non-link-text inside a label, but a label consisting of a single link probably won't be a great user experience.

like image 53
Alex Shesterov Avatar answered Sep 21 '22 11:09

Alex Shesterov