使用 tt、i、b、big、small 标签有什么优点?

发布于 2024-08-07 12:24:16 字数 60 浏览 7 评论 0原文

tt、i、b、big、small 标签并未弃用,但可以通过 CSS 实现更丰富的效果。使用这些有什么好处?

The tt, i, b, big, and small tags are not deprecated, but it is possible to achieve richer effect with CSS. What is the merit of using these?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

鹿! 2024-08-14 12:24:16

好吧,可能会说样式化的

几乎可以做其他 html 标签可以做的任何事情,那么为什么要使用比这些标签更多的标签呢? ?答案是标签主要不是用于样式。它们主要用于识别信息类型。因此, 不用于显示斜体;它用于指示里面的内容应该强调强调取决于内容读者。

Well, it might be said that a styled <div> or <span> could do pretty much anything that other html tags can, so why have more than these tags? The answer is that the tags are not principally for styling. They are principally for identifying types of information. So, <em> is not used for putting on italics; it's used for indicating that the content inside should be emphasized. What emphasis is depends on the content reader.

虽然是的,它更短并且易于使用,但当前的问题是语义标记 - 基本上,毫无疑问 是什么应该对用户有意义。这对于颜色和字体粗细没有意义的情况尤其重要(例如,对于使用文本转语音系统的盲人)。

如果您在美国政府机构(美国的任何政府,而不仅仅是联邦政府)工作,您将受到《美国残疾人法案》的约束。联邦政府特别受第 508 条约束……但在实践中,遵循网页内容可访问性也是很好的选择指南。公司明智的做法是遵循这些指南,以减少诉讼的可能性,然后必须重新设计侧面以正确处理这些问题。

附注你没有提到的一个总是困扰我的元素是 ...为什么人们喜欢使用 ; ......

Although yes, it's shorter and there's ease of use, the issue at hand is semantic markup -- basically, there's no question about what <strong> and <em> are supposed to mean to the user. This is especially important for cases where color and font-weight are meaningless (eg, to a blind person who's using a text-to-speach system).

If you're working for a US government agency (any government in the US, not just feds), you're bound by the American with Disabilities Act. Feds are specifically bound by Section 508 ... but in practice, it's also good to follow the Web Content Accessibility Guidelines. Companies would be wise to also follow the guidelines to reduce the possibility of a lawsuit and then having to redesign the side to correctly handle these issues.

ps. The one element that you didn't mention that's always bugged me is specifically <th> ... why the hell do people like using <td><b> ... </b></td> or <td class='header'> ...?

無處可尋 2024-08-14 12:24:16

Small、b 和 i 在 HTML5规范并且在未来将具有更大的意义。

其他人喜欢使用 b 或 i 元素来表示纯粹的视觉标记,例如在 Nifty 中为盒子添加圆角的corners技术

small, b and i all have new/better definitions in the HTML5 spec and will have greater meaning in the future.

Other people like to use b or i elements to denote purely visual markup, for example in the Nifty corners technique for adding rounded corners to boxes

绅刃 2024-08-14 12:24:16

比较以下内容:

<span style="font-weight:bold">Some Text</span>

<style type="text/css"><!-- .b{font-weight:bold;} --></style>
<span class="b">Some Text</span>

<b>Some Text</b>

肯定 是最短的 此外,即使在网络标准已经发展和成熟的今天,这些标签也被大量使用。

Compare the following:

<span style="font-weight:bold">Some Text</span>

and

<style type="text/css"><!-- .b{font-weight:bold;} --></style>
<span class="b">Some Text</span>

and

<b>Some Text</b>

Definitely <b> and </b> is the shortest. Also, those tags were quite heavily used even today where web standards has grown and matured a lot.

年华零落成诗 2024-08-14 12:24:16

也许是因为语义的原因。对于读取代码的人(机器人、用户)来说,拥有 Some important text 更有意义(实际上已弃用:Some important text< ;/strong>) 比 一些重要文本

Span 可以包含任何内容,但通常,strong 包含一些内容被注意到。

Perhaps it is because of semantics. It makes more sense for someone (robot, user) who reads the code to have <b>Some important text</b> (really deprecated for: <strong>Some important text</strong>) than <span style='font-weight:bold'>Some important text</span>

Span could contain anything, but, generally, strong contains something to be noticed.

呆萌少年 2024-08-14 12:24:16

我能想到的唯一“优点”是它们受到所有主要浏览器的支持并且对我们来说很简单。例如,如果您只想将某段文本设置为斜体,那么只需使用 i 即可。它比在 CSS 中编写等效内容要简单得多,而且您会知道它会按预期工作。

The only "merit" I can think of is that they are support by all the major browsers and they are simple to us. For example, if all you want to do is italicize some piece of text, then just use i. It's much more simple than writing the equivalent in CSS and you'll know that it will work as expected.

没有心的人 2024-08-14 12:24:16

使用这些的最大优点是它允许浏览项目(网络浏览器等)决定如何呈现相关文本。创建这些是为了考虑到并非所有浏览器都能够以粗体显示某些内容的事实(有人还记得 lynx 吗?)。大多数时候,这不再是问题,技术的发展速度比当前标准快得多,但过去确实如此。你会发现,8 年前,彩屏手机还很稀有,而现在已经很常见了。

The biggest merit of using these, is that it allows the browsing item (web browser etc.) to decide how the text in question is rendered. These were created to account for the fact that not all browsers might be able to display something in bold (anyone remember lynx?). Most of the time this isn't a problem anymore technology has moved a lot faster than the current standards, but it certainly was in the past. You figure that a phone with a color screen was a rarity 8 years ago, where it is commonplace now.

我偏爱纯白色 2024-08-14 12:24:16

您不应使用它们,因为它们指定如何显示,而不是指定类型。 IE 他们将表示与内容结合在一起,这不利于可维护性。因此,不要使用 ,而是使用 。然后,如果需要,可以在一处设置 样式。

You shouldn't use these as they specify how to display rather than specifying the type. I.E. they couple the representation with the content which is bad for maintainability. So instead of <b> use <strong>. Then one can style <strong> in one place if required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文