何时使用何时使用 ?
可能的重复:
可以使用吗?代替 盲目?
何时使用以及何时使用
或其他方式来呈现粗体外观?
strong
具有语义价值(对于屏幕阅读器很有用,而 b
是表示(甚至在 HTML 5 中有效)。
我的问题不是 strong 和
strong 之间有什么区别
和 b
问题是何时使用语义标记以及何时仅使用使文本粗体
如果客户端的内容文件,我是否应该始终使用 。 (MS Word 文件)内容段落中有一些单词粗体?
alt text http://shup.com/Shup/365676/11051764618-My-Desktop.png
我们如何知道客户何时想要强调文本以及何时只想将文本加粗以进行演示/审美目的?
如果是客户的工作来告诉我们,那么如何向客户解释这种情况,以便为我们提供“当他只是为了演示/审美目的而将文本加粗时”的明确信息?
Possible Duplicate:
Is it ok to use <strong> in place of <b> blindly ?
When to use <strong>
and when to use <b>
or other ways to give look of bold? strong
has semantic value ( and useful for screen reader while b
is presentation (and even valid in HTML 5).
my question is not what is the difference between strong
and b
.
The question is when to use semantic tag and when to use just to make text bold
Should I always use <strong>
if client's content files (MS word files) has some words bold in content paragraphs?
alt text http://shup.com/Shup/365676/11051764618-My-Desktop.png
How can we know when client want to give emphasis to text and when he just want to make text bold for presentation/aesthetic purpose?
If it's client job to tell us, then how to explain this scenario to client to give us clear info on "when he just want to make text bold for presentation/aesthetic purpose" ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我一直遵循一个简单的经验法则:
表示“强烈强调”,并且暗示没有特定的视觉风格。它具有语义意义,但看起来可以像任何东西。
用于对文本应用粗体视觉效果,但它是类似于
的表示性标记,因此应避免使用(尽可能)支持CSS。
I've always followed a simple rule of thumb:
<strong>
means "strong emphasis", and implies no particular visual style. It has semantic meaning, but could look like anything.<b>
is used to apply a bold visual effect to text, but is a presentational tag like<font>
and so should be avoided (where possible) in favour of CSS.理解地阅读客户的文字。
(即使在数据库、提要阅读器或没有样式表中)。在这种情况下,可以使用大胆来吸引读者的眼球。
如有疑问,请询问客户他的意思是什么。
为了避免您和您自己的麻烦,请要求客户在其编辑器中使用格式样式。这是一个非常有用的功能,遗憾的是很少有人知道这个功能的用途。
编辑:
这是强,这是粗体。有什么区别吗?
所有的问题都从这里开始。如果
strong
默认为红色(SO 上没有红色标记)并且重量正常,则不会出现这样的问题。Read the client's text with understanding.
<strong>
when the context says that the bold text is more important than the other (and it is inline)<b>
if it just should be bold (even in database, feed reader or without stylesheets). In this case boldness may be used to catch the readers eye.When in doubt, ask the client what did he meant.
To save you and yourself a hassle, ask the client to use formatting styles in his editor. This is very useful feature, pity that there few people who do know what for this feature is.
Edit:
This is strong and this is bold. Any difference?
All the problems begin here. If the
strong
were by default colored RED (no red markup on SO), and normal weight, there would be no questions like this.对此没有“正确”的答案(这可能就是语义标记状态不佳的原因)。
根据您客户的工作方式,我认为您用
替换段落中的粗体内容以及具有相关标题样式的其他所有内容的建议是合理的。对文档进行抽样以确定所使用的实践可能是一个好主意。
There's no "right" answer to this (which is probably why semantic markup isn't in a good state).
Depending on the way your client works I'd say your proposal to replace emboldened content in paragraphs with
<strong>
, and everything else with relevant heading styles, is reasonable. It may be a good idea to sample the documents to establish what practice has been used.首先询问客户“为什么要突出显示这些词?”并用它来指导你的决定。如果您无法得到明确的答案,我会使用 因为最好不要暗示突出显示的单词有语义,而实际上没有语义。 的使用可以清楚地表明您的表现标记不令人满意,因此对未来的维护人员很有帮助,因为可以根据有关突出显示原因的新信息自由更正它。
First ask the client "why have you highlighted these words?" and use that to inform your decision. If you can't get a clear answer, I'd use <B> since it's better to not imply that there are semantics to the highlighted words when in fact there are none. Use of <B> can be used as a clear indication that you have unsatifactory presentational markup, and therefore helpful to future maintainers that it can be freely corrected in the light of new information about the reason for the highlighting.
如果您要将 Word 文档转换为 HTML,那么我认为
是更好的选择,因为您传达的事实是文本是粗体样式来应用语义,因此,如果它标有“强”样式,那么您可以在HTML。
If you're doing a conversion of a word document to HTML, then I think
<b>
is a better choice, because you're conveying the fact that the text was bold in the word document. Word uses styles to apply semantic meaning, so if it's marked with the "Strong" style, then you use the<strong>
tag in the HTML.使用 CSS 为
标记定义默认粗体以外的样式是可以理解的。
在
标签上以同样的方式使用 CSS 会更值得怀疑。
Using CSS to define a style other than default bold for a
<strong>
tag is understandable.Using CSS the same way on a
<b>
tag would be more questionable.