Alternative to the HTML Bold tag

后端 未结 21 1827
野性不改
野性不改 2020-12-23 15:35

Okay, so I know that in HTML you can use the tag, but isn\'t there a \"weight=bold\" attribute that I can use in the

21条回答
  •  执念已碎
    2020-12-23 16:28

    If the text's meaning is semantically strong, use the strong element. If not, use a semantic named class (one that clearly shows the meaning of the element, don't mix presentation and data by calling it bold etc) and reference it in your CSS.

    HTML

    I'm important!
    

    CSS

    .important-message {
       font-weight: bold;
    }
    

    Some people still use the b element as a presentational hook, but it hasn't been deprecated, though most people favour the strong element nowadays. Just make sure they are used correctly.

提交回复
热议问题