html5语义标签,用于文章摘要和突出显示 [英] html5 semantic tag for an article summary and highlight

查看:497
本文介绍了html5语义标签,用于文章摘要和突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个合适的html5标签,我可以用它来标记一篇非常冗长的文章摘要。摘要本身可以跨越一两段。

I am looking for a proper html5 tag which I can use for marking summary of a very lengthy article. The summary itself can span for a paragraph or two.

我知道有一个< summary> 标签html5但此标记与< details> 标记一起使用。

I know there is a <summary> tag in html5 but this tag behaves in conjunction with <details> tag.

其次,我想在一篇长篇文章的中间突出显示一两段。这些突出显示的部分是需要突出显示的重要文本。这有什么html5标签吗?或者我应该只使用一个类突出显示?关键是,它不是视觉上的重要性,而是包含语义重要性。

and secondly, I want to highlight a paragraph or two in the middle of a lengthly article. These highlighted section are important text that needs to be prominently displayed. Is there any html5 tag for this? or should I just use a class for highlighting? The point is, it's just not visual importance, but includes semantic importance.

推荐答案

不,没有块级元素重要性,并没有任何元素的摘要(详细信息内的摘要元素根本不是一个摘要,而是而且是一种类型的标题。

No, there is no block-level element for importance, and no element whatsoever for a summary (the summary element inside details is not really for a summary at all but rather a title of a kind).

在传统的HTML中,包括HTML 4.01(和XHTML 1.0), em strong 表示强调,但它们的定义非常模糊。在实践中,它们只不过是斜体和粗体的伪语义对应物, i b 。 HTML5通过区分压力强调(改变句子的意思)和强烈的重要性,严肃性或紧迫性而没有真正定义差异,使话题更加混乱。在任何情况下, em strong 都是文本级(内联)标记,用于单个单词或短语而非而不是整个句子,更少的段落或段落序列。

In traditional HTML up to and including HTML 4.01 (and XHTML 1.0), em and strong indicate emphasis, but their definitions are very vague. In practice, they are little else than pseudo-semantic counterparts of italic and bolding, i and b. HTML5 makes the topic even more confusing by distinguishing between "stress emphasis" (which "changes the meaning of the sentence") and "strong importance, seriousness, or urgency" without really defining the difference. In any case, em and strong are text-level (inline) markup, intended for individual words or short phrases rather than entire sentences, still less paragraphs or sequences of paragraphs.

最接近的是< p>< strong> ... < / strong>< / p> ,但这是否是个好主意值得怀疑。这肯定不是 strong 的使用方式,但它正式有效。

The closest you can get is <p><strong>...</strong></p>, but it is questionable whether this is a good idea. It’s surely not the way strong is meant to be used, but it’s formally valid.

因此,实用的方法使用 div 元素(或者 p 元素)和属性和合适的样式。

Thus, the practical approach is to use div elements (or maybe p elements) with a class attribute and suitable styling.

这篇关于html5语义标签,用于文章摘要和突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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