跨标签和标签标签之间的渲染差异是多少? [英] Whats the rendering difference between a span and label tag?

查看:109
本文介绍了跨标签和标签标签之间的渲染差异是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我了解跨标签和标签标签之间的功能差异...但是看起来标签之间也有一个渲染差异,我似乎无法弄清楚它是什么?有谁知道跨度和标签之间的渲染差异?谢谢

So I understand the functional difference between the span and label tags... however it appears there is also a rendering difference between the tags and I can't seem to figure out what it is? Does anyone know the rendering difference between span and label? Thanks

推荐答案

除了默认的渲染样式(标签在某些浏览器中有时是粗体),重要的区别是它的标签应该链接到表单域(输入,选择等)到LABEL该字段是什么。因此它是for属性。除此之外,它不应该被用于任何东西。这对屏幕阅读器的可访问性尤其重要,因为他们期望这个链接存在。

Aside from the default rendering styles (label is sometimes bold in some browsers), the important difference is that a label it supposed to be linked to a form field (input, select, etc) to LABEL what that field is. Hence it's "for" attribute. It should not be used for anything but that. This is especially important with regards to accessibility with screen readers as they expect this link to exist.

跨度是一组文本,你想应用一个类似的风格到。 Span默认情况下没有应用风格。

Span is for a group of text that you'd like to apply a similar style to. Span by default has no style applied to it.

PS:如果我抓住你使用标签标签,只是为了使一些文本变粗或粗体,可以让Grayskull的愤怒这样的东西在我之后重复:没有输入字段,没有标签。

PS: May the wrath of Grayskull find you if I ever catch you using a label tab just to make some text bold or something like that. Repeat after me: "no input field, no label".

PPS:对不起,这是我最大的烦恼之一,其他人的标记。

PPS: Sorry, it's one of my biggest annoyances with other people's markups.

这篇关于跨标签和标签标签之间的渲染差异是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆