gpt4 book ai didi

html - 根据规范,标题(书籍、电影等)的正确语义 HTML 标记是什么?它是 标签还是其他什么?

转载 作者:行者123 更新时间:2023-12-02 03:11:17 25 4
gpt4 key购买 nike

我正在尝试确定用于标题(书籍、电影、歌曲等)的 HTML 的最佳做法。我想弄清楚是否 <em>是正确的,还是斜体的 <span> , 或者是其他东西。使用 <em> 在语义上是否正确?标题的标签/元素,根据 HTML 规范或惯例?

例如,这是一本书的书评摘录,标题为:“Reaching & Teaching Them All”,我想知道如何标记标题本身:

"Initial meetings with students are key to making a good first impression and offer a critical opportunity to put children at ease. By carefully orchestrating your relationship with students in those early encounters, you can create a better learning environment that will help to encourage listening and learning. Reaching & Teaching Them All suggests various ways for getting and maintaining student attention and interest, including telling stories, playing games, embracing body language, and using humour and sarcasm."

最佳答案

好吧,问题是:标题本身并不强调。所以,如果你的目标是语义意义,我认为简单的答案是:不,一个 <em>不是正确的选择。

Mozilla 提供了一个很好的简单指南,in their docs on <em> .这不是佳能,但非常接近:

The element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself.

所以,除非你改变句子的意思或重音,<em>不推荐。相反,他们建议:

Use the <cite> element to mark the title of a work (book, play, song, etc.).

然后,使用 CSS 设置 <cite> 的展示样式斜体。

关于html - 根据规范,标题(书籍、电影等)的正确语义 HTML 标记是什么?它是 <em> 标签还是其他什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57513872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com