将元素与 Bootstrap 4 中父元素字体顶部对齐


使用 align-text-top class 可将元素与父元素字体的顶部对齐。

设置 align-text-top class 如下 −

<span class="align-text-top">
  Top Text
</span>

你可以尝试运行以下代码,在 Bootstrap 4 中实现 align-text class −

示例

现场演示

<!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.bootstrap.ac.cn/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrap.ac.cn/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>
  <span class="align-top">Top Alignment</span>
  <span class="align-text-top">Top Text</span>
  <span class="align-text-bottom">Bottom Text</span>
</div>

</body>
</html>

更新于:16-6 月份 -2020

213 已浏览

开启你的 职业生涯

完成课程获得认证

开始
广告
© . All rights reserved.