Bootstrap實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

1. 表格的一些樣式

創(chuàng)新互聯(lián)是一家網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),提供網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),網(wǎng)站制作,建網(wǎng)站,定制網(wǎng)站開發(fā),網(wǎng)站開發(fā)公司,于2013年開始是互聯(lián)行業(yè)建設(shè)者,服務(wù)者。以提升客戶品牌價(jià)值為核心業(yè)務(wù),全程參與項(xiàng)目的網(wǎng)站策劃設(shè)計(jì)制作,前端開發(fā),后臺(tái)程序制作以及后期項(xiàng)目運(yùn)營并提出專業(yè)建議和思路。

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

舉例:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css"> 
  <script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
 <table class="table table-striped">
 <caption>這是一個(gè)測(cè)試表格</caption>
 <thead>
  <tr>
   <th>姓名</th>
   <th>年齡</th>
   <th>地區(qū)</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>小胡子</td>
   <td>26</td>
   <td>陜西</td>
  </tr>
  <tr>
   <td>大胡子</td>
   <td>26</td>
   <td>北京</td>
  </tr>
  </tbody>
</table>
</body>
</html>

頁面效果:

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

2. 表格行或單元格的樣式

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

舉例:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css"> 
  <script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
 <table class="table table-striped">
 <caption>這是一個(gè)測(cè)試表格</caption>
 <thead>
  <tr>
   <th>姓名</th>
   <th>年齡</th>
   <th>地區(qū)</th>
  </tr>
 </thead>
 <tbody>
  <tr class="info">
   <td>小胡子</td>
   <td>26</td>
   <td>陜西</td>
  </tr>
  <tr class="warning">
   <td>大胡子</td>
   <td>26</td>
   <td>北京</td>
  </tr>
  </tbody>
</table>
</body>
</html>

頁面效果:

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

3. 表單布局

(1)垂直表單:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css"> 
  <script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form">
 <div class="form-group">
  <label for="name">姓名</label>
  <input type="text" class="form-control" id="name" placeholder="請(qǐng)輸入姓名">
 </div>
 <div class="form-group">
  <label for="inputfile">選擇文件</label>
  <input type="file" id="inputfile">
 </div>
 <button type="submit" class="btn btn-default">提交</button>
</form>
</body>
</html>

效果:

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

(2)內(nèi)聯(lián)表單:它的所有元素是內(nèi)聯(lián)的,向左對(duì)齊的,標(biāo)簽是并排的

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css"> 
  <script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form" class="form-inline">
 <div class="form-group">
  <label for="name">姓名</label>
  <input type="text" class="form-control" id="name" placeholder="請(qǐng)輸入姓名">
 </div>
 <div class="form-group">
  <label for="inputfile">選擇文件</label>
  <input type="file" id="inputfile">
 </div>
 <button type="submit" class="btn btn-default">提交</button>
</form>
</body>
</html>

效果:

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

(3)水平表單:水平表單與其他表單不僅標(biāo)記的數(shù)量上不同,而且表單的呈現(xiàn)形式也不同

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css"> 
  <script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form" class="form-horizontal">
 <div class="form-group">
    <label for="name" class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="name" placeholder="請(qǐng)輸入姓名">
    </div>
 </div>
 <div class="form-group">
    <label for="inputfile" class="col-sm-2 control-label">選擇文件</label>
    <div class="col-sm-10">
      <input type="file" id="inputfile">
    <div>
 </div>
 <div class="form-group">
   <div class="col-sm-12">
    <button type="submit" class="btn btn-default">提交</button>
   </div>
 </div>
</form>
</body>
</html>

效果:

Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼

總結(jié)

以上所述是小編給大家介紹的Bootstrap 實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!

網(wǎng)頁名稱:Bootstrap實(shí)現(xiàn)表格樣式、表單布局的實(shí)例代碼
地址分享:http://bm7419.com/article42/psohec.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、商城網(wǎng)站、微信公眾號(hào)、云服務(wù)器、響應(yīng)式網(wǎng)站、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計(jì)公司