Bootstrap全局CSS样式按钮和图片以及表格和表单
作者:互联网
Bootstrap全局CSS样式按钮和图片
全局CSS样式:
按钮:class="btn btn-default"
<body> <a class="btn btn-default" href="#">Link</a> <button class="btn btn-default" type="submit">Button</button> <input class="btn btn-default" type="button" value="Input"> <input class="btn btn-default" type="submit" value="Submit"> <br> <!-- Standard button --> <button type="button" class="btn btn-default">(默认样式)Default</button> <!-- Provides extra visual weight and identifies the primary action in a set of buttons --> <button type="button" class="btn btn-primary">(首选项)Primary</button> <!-- Indicates a successful or positive action --> <button type="button" class="btn btn-success">(成功)Success</button> <!-- Contextual button for informational alert messages --> <button type="button" class="btn btn-info">(一般信息)Info</button> <!-- Indicates caution should be taken with this action --> <button type="button" class="btn btn-warning">(警告)Warning</button> <!-- Indicates a dangerous or potentially negative action --> <button type="button" class="btn btn-danger">(危险)Danger</button> <!-- Deemphasize a button by making it look like a link while maintaining button behavior --> <button type="button" class="btn btn-link">(链接)Link</button> </body>
图片:
class="img-responsive":图片在任意尺寸都占100%
<img src="img/banner_1.jpg" class="img-responsive">
图片的形状:
<img src="img/banner_1.jpg" class="img-responsive img-rounded"> <img src="img/banner_1.jpg" class="img-responsive img-circle"> <img src="img/banner_1.jpg" class="img-responsive img-thumbnail">
表格:
添加 .table-bordered
类为表格和其中的每个单元格增加边框。
通过添加 .table-hover
类可以让 <tbody>
中的每一行对鼠标悬停状态作出响应。
<table class="table table-bordered table-hover"> <tr> <td>编号</td> <td>姓名</td> <td>年龄</td> </tr> <tr> <td>001</td> <td>张三</td> <td>18</td> </tr> <tr> <td>002</td> <td>李四</td> <td>20</td> </tr> <tr> <td>003</td> <td>王五</td> <td>28</td> </tr> </table>
表单:
给表单添加class="form-horizontal"
<form class="form-horizontal"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">Email</label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputEmail3" placeholder="Email"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label">Password</label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label> <input type="checkbox"> Remember me </label> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">Sign in</button> </div> </div> </form>
标签:样式,Bootstrap,表单,按钮,class,CSS,图片 来源: https://www.cnblogs.com/xjw12345/p/16553960.html