Bootstrap響應式表格詳解,bootstrap響應詳解

來源:互聯網
上載者:User

Bootstrap響應式表格詳解,bootstrap響應詳解

Bootstrap 的響應式 CSS 能夠自適應於台式機、平板電腦和手機

下面是手機端顯示的樣式

代碼如下:

1.test.php

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><link type="text/css" rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" /><script src="jquery-3.2.0.min.js"></script><script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script><!-- HTML5 Shim 和 Respond.js 用於讓 IE8 支援 HTML5元素和媒體查詢 -->  <!-- 注意: 如果通過 file:// 引入 Respond.js 檔案,則該檔案無法起效果 -->  <!--[if lt IE 9]>   <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>   <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>  <![endif]--></head><body><h1>汽車資訊</h1><table class="table table-striped"> <thead> <tr>  <th>代號</th>  <th>名稱</th>  <th class="hidden-xs">系列</th>  <th class="hidden-xs">上市時間</th>  <th class="hidden-xs">油耗</th>  <th class="hidden-xs">功率</th>  <th>價格</th>  <th class="visible-xs-block">詳情</th> </tr> </thead> <tbody> <?php require "DBDA.class.php"; $db = new DBDA(); $sql = "select * from car"; $arr = $db->query($sql,1); foreach($arr as $v) {  echo "<tr>  <td>{$v[0]}</td>  <td>{$v[1]}</td>  <td class='hidden-xs'>{$v[2]}</td>  <td class='hidden-xs'>{$v[3]}</td>  <td class='hidden-xs'>{$v[4]}</td>  <td class='hidden-xs'>{$v[5]}</td>  <td>{$v[7]}</td>  <td class='visible-xs-block'>  <button type='button' class='btn btn-primary btn-xs xq' code='{$v[0]}'>詳情</button>  </td> </tr>"; }  ?> </tbody></table><!-- 模態框(Modal) --><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog">  <div class="modal-content">   <div class="modal-header">    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>    <h4 class="modal-title" id="myModalLabel">汽車詳細資料</h4>   </div>   <div class="modal-body" id="neirong"></div>   <div class="modal-footer">    <button type="button" class="btn btn-default" data-dismiss="modal">關閉</button>   </div>  </div><!-- /.modal-content --> </div><!-- /.modal --></div><script type="text/javascript">$(".xq").click(function(){ //顯示詳細資料  //取代號 var code = $(this).attr("code"); //查詢該汽車的所有資訊 $.ajax({  url:"chuli.php",  data:{code:code},  type:"POST",  dataType:"TEXT",  success: function(data){   var lie = data.trim().split("^");   var str = "<div>代號:"+lie[0]+"</div><div>名稱:"+lie[1]+"</div>   <div>系列:"+lie[2]+"</div><div>上市時間:"+lie[3]+"</div><div>油耗:"+lie[4]+"</div><div>功率:"+lie[5]+"</div><div>價格:"+lie[7]+"</div>";   $("#neirong").html(str);   //觸發模態框   $('#myModal').modal('show');  } });})</script></body></html>

2.chuli.php

<?php$code = $_POST["code"];require "DBDA.class.php";$db = new DBDA();$sql = "select * from car where code='{$code}'";echo $db->strquery($sql);

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援幫客之家。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.