htmlMethods to bold fonts: 1. Use the "<b>" tag, the syntax <b>text that needs to be bolded"; 2. Use the style attribute in the tag, Add the "font-weight:bold|bolder" style, with the value "bold" defining bold characters and "bolder" defining bolder characters.
This tutorial Operating environment: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
Method 1: Use <b> tag
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> <b>加粗字体</title> </head> <body> <div> <p>这是一段测试文字,<b>这里使用b标签来加粗字体</b> </p> </div> </body> </html>
Operating effect:
We can already see from the picture that the second half of the text has a bold font, which can be compared with the first half of the text (the text is bold). Here we mainly use The <b>
tag in html, the use of the <b>
tag in html is very simple, just write the required information directly in the <b>
tag Just make the text bold!
Method 2: Use the style attribute in the tag and add the "font-weight:bold|bolder" style
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>css 文字加粗</title> <style> p.normal { font-weight: normal; } p.bold { font-weight: bold; } p.bolder { font-weight: bolder; } p.thicker { font-weight: 900; } </style> </head> <body> <p class="normal">测试文本!</p> <p class="bold">测试文本!</p> <p class="bolder">测试文本!</p> <p class="thicker">测试文本!</p> </body> </html>
Rendering :
Description:
The font-weight attribute can set the thickness of the text, which is generally used to set the bold font used in the text of the display element
Attribute values related to the bold effect:
Value | Description |
---|---|
bold | Define bold characters. |
bolder | Define bolder characters. |
|
Define characters from thin to thick. 400 is equivalent to normal, and 700 is equivalent to bold. |
Recommended tutorial: "html video tutorial"
The above is the detailed content of How to make font bold in html. For more information, please follow other related articles on the PHP Chinese website!