在Bootstrap 4中使用align-baseline类将元素与父元素的基线对齐。
像下面的代码片段一样设置align-baselinec类-
<span class="align-baseline">
现在在其中添加内容-
<span class="align-baseline"> Demo Baseline </span>
您可以尝试运行以下代码以使元素与父级的基线对齐-
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Example</h2> <p>This is demo text<p> <span class="align-baseline">Demo Baseline</span> </div> </body> </html>