标记对话(或采访)的最语义方式?
我试图找出最语义化的方式来标记这样的东西。
John: blah blah
Paul: blah blah
George: blah blah
Ringo: blah blah
或者
John: blah blah
Paul: blah blah
George: blah blah
Ringo: blah blah
理想情况下,CSS 可以灵活地执行或将其分成一个段落,其中名称可见或不可见。我考虑过使用 before:
选择器来添加名称,但我也希望它们是可链接的。例如,如果林戈有推特个人资料,我会链接到他的个人资料。它还应该在屏幕阅读器中正确阅读。
I'm trying to figure out the most semantic way to markup something like this.
John: blah blah
Paul: blah blah
George: blah blah
Ringo: blah blah
or
John: blah blah
Paul: blah blah
George: blah blah
Ringo: blah blah
Ideally there'd be the CSS flexibility to do either or to break it into a paragraph with or without the names visible. I considered using the before:
selector to add the names, but I also want them to be linkable. For example, I'd link to Ringo's twitter profile if he had one. It also should read properly in screenreaders.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HTML5 规范对此进行了讨论,其要点是:
因此,最终,类似这样的事情:
这将使您能够按照您描述的方式进行样式设置。当然,如果需要,您还可以添加
class
属性。您本能地不使用:before
选择器将名称放入 CSS 中是一个很好的选择 - 此信息绝对应该位于标记中。The HTML5 spec discusses this, the gist of which is:
So, ultimately, something like this:
This would enable styling in the way you describe. You could, of course, also add
class
attributes if necessary. Your instinct not to put the names in CSS with the:before
selector is a good one--this information should definitely be in the markup.嗯。
提示 - 使用 xml 进行标记。应该会让以后更容易使用
类似
之类的东西
hm.
Tip - use xml to mark it up. Should make it easier to work with later
something like
<voice speaker="John"></voice>
maybe