在Bootstrap中设置列顺序
依次编写各列,并在另一列中显示它们。您可以使用.col-md-push-*和.col-md-pull-*修饰符类轻松更改内置网格列的顺序,其中*范围为1到11。
示例
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet"> <script src = "/scripts/jquery.min.js"></script> <script src = "/bootstrap/js/bootstrap.min.js"></script> </head> <body> <div class = "container"> <h1>Heading</h1> <div class = "row"> <p>Before Ordering</p> <div class = "col-md-4" style = "background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> I am on left </div> <div class = "col-md-8" style = "background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> I am on right </div> </div> <br> <div class = "row"> <p>After Ordering</p> <div class = "col-md-4 col-md-push-8" style = "background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> I was on left </div> <div class = "col-md-8 col-md-pull-4" style = "background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> I was on right </div> </div> </div> </body> </html>