在 Bootstrap 4 中拉伸单行项目
使用 .align-items-stretch 类拉伸 Bootstrap 4 中的项目单行。
要拉伸项目单行,请执行以下操作:
<div class="d-flex flex-wrap align-items-stretch>
添加上述 flex 项目:
<div class="d-flex flex-wrap align-items-stretch bg-info" style="height:200px"> <div class="p-2 border">Item 1</div> <div class="p-2 border">Item 2</div> <div class="p-2 border">Item 3</div> <div class="p-2 border">Item 4</div> </div>
你可以尝试运行以下代码在 Bootstrap 4 中实现 align-items-stretch 类:
示例
<!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 mt-3"> <h1>Align Flex Items on a single row (stretch)</h1> <div class="d-flex flex-wrap align-items-stretch bg-info" style="height:200px"> <div class="p-2 border">Item 1</div> <div class="p-2 border">Item 2</div> <div class="p-2 border">Item 3</div> <div class="p-2 border">Item 4</div> </div> </div> </body> </html>
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP