在 HTML 中创建粗体文本
htmlweb developmentfront end technology更新于 2026/1/16 3:56:17
在 HTML 中,<strong> 标签用于使文本显示为粗体。它是一个解析标签,用于显示文本的重要性。此标签支持 HTML 中的所有全局属性和事件属性。以下是 HTML 中 strong 标签的用法 -
<strong> text… </strong>
它有开始和结束标签。在 HTML 中,我们使用 <b> 标签来指定不包含额外重要内容的粗体文本。
示例
以下示例演示了 HTML 中 <strong> 标签的用法 −
<!DOCTYPE html>
<html>
<body>
<h1>Tutorial Point</h1>
<p>Normal text without strong tag.</p>
<p>
<strong>Text with strong tag</strong>
</p>
</body>
</html>
示例
考虑另一个示例,其中文本显示为粗体,但没有使用 <strong> 标签 −
<!DOCTYPE html>
<html>
<head>
<title>Usage of strong Tag</title>
<style>
body {
text-align: center;
}
h1 {
color: blue;
}
.TP {
font-weight: bold;
}
</style>
</head>
<body>
<h1>TutorialsPoint</h1>
<h2>Font appears as BOLD</h2>
<div class="TP">HTML Tutorial</div>
</body>
</html>
示例
考虑另一个示例以了解有关 <strong> 标签的更多信息−
<!DOCTYPE html>
<html>
<head>
<title>Usage of strong Tag</title>
<style>
body {
text-align:center;
}
h1 {
color:blue;
}
strong {
font-weight:bold;
}
</style>
</head>
<body>
<h1>TutorialsPoint</h1>
<h2>Font appears as BOLD</h2>
<strong>HTML Tutorial</strong>
<p> To see effects , change default CSS Settings</p>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

