(X) 书名的 HTML 标记
书名是否应该包含在 中? 标签? 如果不是 有更合适的标记吗?
Should book titles be contained in an <em> tag? If not <em> is there more appropriate markup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
肯定是错误的。 除了我之前给出的其他建议(例如 RDFa 或语义类名称)之外,请考虑使用
来自 HTML 5 草案:
<em> is definitely wrong. In addition to the other suggestions given before me such as RDFa or a semantic class name, consider using <cite>
From the HTML 5 draft:
我将使用 RDFa 与任何标签。 RDFa 规范允许您在 HTML 中添加一些语义。 例如,您的标题将使用 Dublin-Core 属性
dc:title.
进行注释I would use RDFa with any tag. The RDFa specificaton allow you to add some semantic in your HTML. for example your titles would be annotated with the Dublin-Core property
dc:title.
这实际上取决于上下文。他们甚至可能使用标签,具体取决于您显示书名的方式和位置。 如果您将其显示在书籍列表中,则可以使用带有
对于一本书来说确实没有“语义正确”的标签,但是您可以创建一个易于阅读且有意义的标记。
It really depends on the context.. They might even use <h1-6>-tags depending on how and where you display the book titles. If you display it in a list of books, you could use a definition list with the <dt> tag as the book title, and <dd> tag(s) for the author(s).
There is really no "semantically correct" tag for a book, but you can create a markup that is easy to read and makes sense.
对于像书名这样传达语义信息的东西,答案是否定的。 您应该执行类似以下操作:
然后使用 CSS 根据需要设置
BookTitle
样式。For something like a book title that conveys semantic information, the answer is no. You should do something like:
and then use CSS to style
BookTitle
as you please.以下是我一直在开发的 HTML5 语义标记网站的示例,该网站使用 http 中指定的最近接受的微格式: //schema.org 以及 HTML5 的新的更多语义标记元素。
http://blog-to-book.com/view/stuff/about /semantic%20web
Google 有一个方便的语义标记测试工具,可以向您展示它如何看待该页面。恐怕您必须在 google 上搜索它,因为我只允许在我的代表处发布一个链接。 :(
更新:这是链接 http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fblog-to-book.com%2Fview%2Fstuff% 2Fabout%2Fsemantic+web&view=
希望这能为您指明一些有趣的方向。如果您需要更详细的标记,那么“良好关系本体论”几乎是我目前能想到的最全面的本体论。
Here is an example of a HTML5, semantically tagged website that I've been working on that uses the recently accepted Micro-formats as specified at http://schema.org along with the new more semantic tagging elements of HTML5.
http://blog-to-book.com/view/stuff/about/semantic%20web
Googles has a handy Semantic tagging test tool that will show you how it sees that page You'll have to google it i'm afriad as I am only permitted to post one link at my rep. :(
UPDATE: Here is the link http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fblog-to-book.com%2Fview%2Fstuff%2Fabout%2Fsemantic+web&view=
Hope this points you in some interesting directions. If you're after more detailed tagging, then the Good Relations Ontology is pretty much the most comprehensive I can think of right now.
怀疑是这样。 从语义上讲,“
em
”的意思是“强调”而不是“斜体”。嗯,HTML 缺少很多东西,所以我要么只使用通用的
Foobar
或者如果我觉得疯狂的话我会发明我自己的标签(谁说我不能?它将通过定制的 DTD 完美验证,或者我可以使用 XSLT 来转换文档)。Doubt so. Semantically "
em
" means "emphasis" not "italics".Well, HTML lacks a lot of things, so I'd either just use generic
<span class="book-title">Foobar</span>
or if I'll feel a crazy I'll just invent my own tag (who said I can't? it will validate perfectly with customized DTDs or I may use XSLT to transform the document).对于
和
等标签,w3schools.com 声明“它们并未被弃用,但可以通过 CSS 实现更丰富的效果。” 所以我想说它适合书名,除非您更喜欢使用 CSS 进行所有文本格式设置(就像我一样)。
Concerning tags like
<em>
and<strong>
, w3schools.com states that "They are not deprecated, but it is possible to achieve richer effect with CSS." So I would say that it is appropriate for a book title unless you prefer using CSS for all text formatting (as I do).语法规则规定书名(或其他“长”作品的标题)应使用斜体或下划线。 因此,该标签是合适的。
Grammar rules state that book titles (or the titles of other "long" works) should be italicized or underscored. Therefore, the tag is appropriate.