Examples of bootstrap response tables and bootstrap instances

Source: Internet
Author: User

Examples of bootstrap response tables and bootstrap instances

Bootstrap's responsive CSS can adapt to desktops, tablets, and mobile phones. Now, we will give an example of bootstrap's responsive CSS:

As shown in, this table only displays the code, name, and price on mobile phones and other mobile terminals. Others are displayed in View Details (that is :)

First, the mobile terminal can be converted from the left to the right:

The Code is as follows:

<Meta charset = "UTF-8"> <title> </title> <! -- Introduce the css file of bootstrap --> <link type = "text/css" rel = "stylesheet" href = ".. /bootstrap-3.3.7-dist/css/bootstrap.min.css "rel =" external nofollow "> <! -- Introduce js package --> <! -- Introduce the js file of bootstrap --> query ($ SQL); foreach ($ arr as $ v) {echo ""; // Why does id = 'xq' fail? Do not use id. id is unique. Here there are multiple view details .... Remember !!!! }?> <Table class = "table-striped"> <thead> <tr> <th> Code </th> <th> name </th> <th> price </th> <th class = "hidden-xs"> origin </th> <! -- Class = "hidden-xs" aims to not display this column on the mobile phone --> <th class = "hidden-xs"> Inventory </th> <th class =" hidden-xs "> quantity </th> <th class =" visible-xs-block "> operation </th> </tr> </thead> <tbody> <! --? Php require ".. /DB. class. php "; $ db = new DB (); $ SQL =" select * from buyfruits "; $ arr = $ db ---> <tr> <td >{$ v [0] }</td> <td >{$ v [1]} </td> <td >{$ 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 class =" visible-xs-block "> <button type =" button "class =" btn-primary btn-sm xq "code =" {$ v [0]} "id =" xq "> View Details </button> </td> </tr> </tbody> </table>

Second, click to View Details. A modal box is displayed.

<! -- Reference the Modal box (Modal ), can be stored anywhere --> <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> 

Processing page: chuli. php

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

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.