在 Bootstrap 4 中將元素與父級的基線對齊
在 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://ajax.googleapis.com/ajax/libs/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>
廣告