【问题标题】:Bootstrap table word wrap is not working?引导表自动换行不起作用?
【发布时间】:2017-02-01 20:46:15
【问题描述】:

我的引导表有问题。这种风格的引导表适用于宽屏幕,但是当我尝试查看这款平板电脑时,所有列都相互重叠。请帮帮我。

.table{
  table-layout:fixed;
  word-wrap:break-word;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>   <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <div class="table-responsive">
        <table class="table">
            <thead>
               <tr>
			        <th>Cbee ID</th>
			        <th>First Name</th>
			        <th>Last Name</th>
		          	<th>Created On</th>
		         	<th>Email</th>
		        	<th>Facebook ID</th>
		        	<th>LinkedIn ID</th>						
		        	<th>Owner Beevites</th>
			        <th>Attendee Beevites</th>
			         <th>Device ID</th>
			</tr>	
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                  <td>9818c9b8d07c1bb507a05c387d3b3d743725ad81cb93f1858d5143ccd1624bdf</td>
                </tr>                
            </tbody>
        </table>
    </div>

【问题讨论】:

    标签: twitter-bootstrap html-table


    【解决方案1】:

    这样使用

    <div class="table-responsive">
        <table class="table">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Table heading</th>
                    <th>Table heading</th>
                    <th>Table heading</th>
                    <th>Table heading</th>
                    <th>Table heading</th>
                    <th>Table heading</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                </tr>
                <tr>
                    <td>3</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                    <td>Table cell</td>
                </tr>
            </tbody>
        </table>
    </div>
    

    【讨论】:

    • 我以前用过的相同代码...但我仍然有相同的问题
    【解决方案2】:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
      <h2>Basic Table</h2>
      <p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p>
     <div class="table-responsive">              
      <table class="table">
        <thead>
          <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>Email</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>John</td>
            <td>Doe</td>
            <td>john@example.com</td>
          </tr>
          <tr>
            <td>Mary</td>
            <td>Moe</td>
            <td>mary@example.com</td>
          </tr>
          <tr>
            <td>July</td>
            <td>Dooley</td>
            <td>july@example.com</td>
          </tr>
        </tbody>
      </table>
    </div>
    </div>
    
    </body>
    </html>

    【讨论】:

      猜你喜欢
      • 2014-02-15
      • 1970-01-01
      • 2021-05-14
      • 2016-10-22
      • 1970-01-01
      • 2012-07-29
      • 1970-01-01
      • 2014-11-01
      • 1970-01-01
      相关资源
      最近更新 更多