dtihe8614 2015-03-27 15:36
浏览 21
已采纳

如何使我的表格单元格自动适应Bootstrap 3中的内容?

I am fetching data from Mysql database and populating them in a table. However, i cannot seem to make the cell autofit to contents. I have tried width as the property of the table but i cant get it to work Would really appreciate your help. Thanks Here's what i have done so far

<div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">

                <table class="table table-bordered" style="width:100%">
                    <thead>
                      <tr>
                        <th><center>ID</center></th>
                        <th>Name</th>
                        <th><center>Email</center></th>
                        <th>Number</th>
                        <th>Package</th>
                        <th>Flexibility</th>
                        <th >Date</th>
                        <th>Departuring From</th>
                        <th>Departure Date</th>
                        <th>Destination</th>
                        <th>Arrival Date</th>
                        <th>Price</th>
                        <th>Consolidator</th>

                      </tr>
                    </thead>

                    <tbody>
                      <?php

                        $query = 'SELECT * FROM queries';

                        $result = mysql_query($query);

                        while ($row = mysql_fetch_array($result)) {
                            echo '<tr>';
                            echo '<td>'. $row['id'] . '</td>';
                            echo '<td>'. $row['name'] . '</td>';
                            echo '<td>'. $row['email'] . '</td>';
                            echo '<td>'. $row['contactnumber'] . '</td>';
                            echo '<td>'. $row['packagedetails'] . '</td>';
                            echo '<td>'. $row['flexibility'] . '</td>';
                            echo '<td>'. $row['datetoday'] . '</td>';
                            echo '<td>'. $row['departure'] . '</td>';
                            echo '<td>'. $row['dateofdeparture'] . '</td>';
                            echo '<td>'. $row['destination'] . '</td>';
                            echo '<td>'. $row['dateofarrival'] . '</td>';
                            echo '<td>'. $row['price'] . '</td>';
                            echo '<td>'. $row['vendor'] . '</td>';
                            echo '<td width=250>';
                            echo '<a class="btn btn-success" href="readquery.php?id='.$row['id'].'">Read</a>';
                            echo '&nbsp;';
                            echo '<a class="btn btn-success" href="updatequery.php?id='.$row['id'].'">Update</a>';
                            echo '&nbsp;';
                            echo '<a class="btn btn-danger" href="deletequery.php?id='.$row['id'].'">Delete</a>';
                            echo '</td>';
                            echo '</tr>';
                        } 
                        ?>  
                    </tbody>
                </table>
  • 写回答

2条回答 默认 最新

  • doushantun0614 2015-03-28 10:45
    关注

    The problem was not with my table. To make it work, i increased the width of my container in which my table was inside, and it worked

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料