zoukankan      html  css  js  c++  java
  • HTML中<b>标签和<strong>便签的区别

    最近碰到的问题,自己写的时候因为<b>标签比较简短偶尔使用,看到别人有使用<strong>标签的,本人不懂区别,在网上找的别人的东西,觉得很有道理,跟大家分享看看~~


    链接:http://www.zhihu.com/question/20961933/answer/16732800
    来源:知乎

    不要动不动就把英语的术语、名称或概念牵强地翻译成中文。(从英文角度来理解我觉得是有道理的)
    不是「粗体和加重有什么区别」(原题如此),是「HTML 标签 <b> 和 <strong> 有什么区别」。

    HTML 的标签负责将内容标记为 HTML 元素,浏览器的默认 CSS 样式表负责按照 W3C 的建议来指定 HTML 元素的默认样式。

    在那个用 HTML 指定字体、字号、颜色……的时代,HTML 标签 <b> 的意思是「bold」(粗体),它是一个单纯的样式标签,指定文本要用粗体。<strong> 是一个带有着重意味的标签,浏览器通常也把它显示为粗体。
    后来 CSS 兴起,CSS 语句 font-weight: bold 成为首选的设置粗体的手法。<b> 这种样式标签通常被唾弃,而 <strong> 这样的语义标签受推崇。
    后来 HTML5 兴起,重新界定了 <b> <i> <strong> <em> 这几个相似标签的意义。直接从 HTML5 规范原文来看,其实很清楚:
    • <em>:「stress emphasis of its contents」——强调内容。
    • <strong>:「strong importance for its contents」——着重内容。
    Emphasis 和 importance 的区别对于汉语使用者来说可能也比较难把握。但如果你熟悉英语的写作格式,你会明白格式化为斜体的各种强调文本与格式化为粗体的着重文本的区别。英语等西文的正文中,粗体其实是很少出现的。
    • <i>:「a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts」——无强调或着重意味的斜体(italic),比如生物学名、术语、外来语(比如「de facto」这样的英语里常用的拉丁语短语)……
    • <b>:「a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede」——无强调或着重意味的粗体(bold),比如文章摘要中的关键词、评测文章中的产品名称、文章的导言……

    所以是的,正常浏览器里 <b> 和 <strong> 都显示为粗体。
    「在网页显示中」没有什么区别。在代码编写上有区别。

    如果你懒得看 W3C 文档,手头又没有称职的教材或参考书,遇到 HTML 元素意义的问题时,直接去看维基百科的这个词条:HTML element
    你若盛开,清风自来
  • 相关阅读:
    支付扣款 并发 异步
    Floyd-Warshall算法
    black arch
    ChromeDriver only supports characters in the BMP
    Getting console.log output with Selenium Python API bindings
    微信公众号文章批量采集系统的构建
    node npm Bower
    PyPy CPython C++ connects programs written in C and C++ with a variety of high-level programming languages
    timeout connect 10000 # default 10 second time out if a backend is not found
    timeout connect 10000 # default 10 second time out if a backend is not found
  • 原文地址:https://www.cnblogs.com/zhoumomo/p/4935207.html
Copyright © 2011-2022 走看看