flex-column-reverse用于显示具有垂直方向的反向弹性项目。如以下代码段所示,添加flex-column-reverse类-
<div class="d-flex flex-column-reverse">
之后,在其中添加flex项目-
<div class="d-flex flex-column-reverse"> <div class="p-2 bg-secondary">Demo 1</div> <div class="p-2 bg-danger">Demo 2</div> <div class="p-2 bg-info">Demo 3</div> </div>
您可以尝试运行以下代码以垂直和反向显示弹性项目-
<!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 mt-3"> <h2>Implementing Column Reverse</h2> <div class="d-flex flex-column-reverse"> <div class="p-2 bg-secondary">Demo 1</div> <div class="p-2 bg-danger">Demo 2</div> <div class="p-2 bg-info">Demo 3</div> </div> </div> </body> </html>