Bootstrap's heading class (heading style h1~h6)

Bootstrap's heading font size generally follows the following style rules:

  1. h1The title has a font size of 2.5rem (40px).
  2. h2The title has a font size of 2rem (32 pixels).
  3. h3The title has a font size of 1.75rem (28 pixels).
  4. h4The title has a font size of 1.5rem (24 pixels).
  5. h5The title has a font size of 1.25rem (20 pixels).
  6. h6The title has a font size of 1rem (16 pixels).

These styles can be customized according to the needs of the project. Note that these font sizes are part of Bootstrap's default styles, which you can adjust or override to suit your own project needs.

For the introduction of unit rem, please refer to the link: https://blog.csdn.net/wenhao_ir/article/details/132695607

01-Use Bootstrap's heading class in the paragraph tag

The sample code is as follows:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>使用标题类</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="bootstrap-4.5.3-dist/css/bootstrap.css">
    <script src="jquery-3.5.1.slim.js"></script>
    <script src="bootstrap-4.5.3-dist/js/bootstrap.min.js"></script>
</head>
<body class="container">
    <p class="h1">一级标题样式</p>
    <p class="h2">二级标题样式</p>
    <p class="h3">三级标题样式</p>
    <p class="h4">四级标题样式</p>
    <p class="h5">五级标题样式</p>
    <p class="h6">六级标题样式</p>
</body>
</html>

The running effect is shown in the figure below:
insert image description here
insert image description here

<h>02- Use Bootstrap's title class in HTML tags

The sample code is as follows:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>使用标题类</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="bootstrap-4.5.3-dist/css/bootstrap.css">
    <script src="jquery-3.5.1.slim.js"></script>
    <script src="bootstrap-4.5.3-dist/js/bootstrap.min.js"></script>
</head>
<body class="container">
	<h1 class="h1">这是一个Bootstrap h1标题</h1>
	<h2 class="h2">这是一个Bootstrap h2标题</h2>
	<h3 class="h3">这是一个Bootstrap h3标题</h3>
	<h4 class="h4">这是一个Bootstrap h4标题</h4>
	<h5 class="h5">这是一个Bootstrap h5标题</h5>
	<h6 class="h6">这是一个Bootstrap h6标题</h6>
</body>
</html>

The running effect is shown in the figure below:
insert image description here

03- Use HTML <small>tags to achieve subtitle effects

The sample code is as follows:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>使用HTML的small标签设置辅助标题</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="bootstrap-4.5.3-dist/css/bootstrap.css">
    <script src="jquery-3.5.1.slim.js"></script>
    <script src="bootstrap-4.5.3-dist/js/bootstrap.min.js"></script>
</head>
<body class="container">
    <h1 class="h1">水调歌头<small>明月几时有</small></h1>
	<h2 class="h2">归园田居<small>归园田居生活记趣</small></h2>
</body>
</html>

The running effect is shown in the figure below:
insert image description here

04-Use the display class to highlight and enlarge the title

The sample code is as follows:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>使标题更突出</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="bootstrap-4.5.3-dist/css/bootstrap.css">
    <script src="jquery-3.5.1.slim.js"></script>
    <script src="bootstrap-4.5.3-dist/js/bootstrap.min.js"></script>
</head>
<body class="container">
	<h1 class="h1">昨夜雨疏风骤</h1>
    <h1 class="h1 display-1">昨夜雨疏风骤(display-1)</h1>
	
	<h2 class="h2">浓睡不消残酒</h2>
    <h2 class="h2 display-2">浓睡不消残酒(display-2)</h2>
</body>
</html>



The running effect is shown in the figure below:
insert image description here

Guess you like

Origin blog.csdn.net/wenhao_ir/article/details/132696366