Html 在标签标签中使用超链接(标签)是标准的吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17964418/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it standard to use Hyperlink(a tag) within label tag?
提问by Mohammad Dayyan
Is it standard to use Hyperlink(a tag) within label tag ?
在标签标签中使用超链接(标签)是标准的吗?
<label for="ContentPlaceHolder1"><a href="~/address">Link Text and Label Name</a></label>
采纳答案by Alex Shesterov
It is validto have an anchor inside a label — in HTML 4.01 as well as HTML5.
在标签内有一个锚点是有效的——在 HTML 4.01 和 HTML5 中。
You can try out the W3C Markup Validatorto quickly check if your markup is valid.
您可以试用W3C 标记验证器来快速检查您的标记是否有效。
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.
是否有意义是另一个问题。在标签内有一个链接和一些非链接文本可能是可以的,但由单个链接组成的标签可能不会是一个很好的用户体验。