色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

CSS-flexbox中的表格太寬

李中冰2年前7瀏覽0評論

我用flexbox創建了我的布局,現在我想顯示表格。但是當一個表有很多記錄的時候,它沒有添加滾動條,它溢出了頁面。有人知道該怎么辦嗎?我在網上多方尋找并發現了這個問題,但是,我沒有找到一個完全可靠的解決方案...為了簡單起見,我簡化了這個例子。謝謝你

<div>
  <div style="display: flex;">
    <!-- Layout -->
    <div style="display: flex;">
      <!-- Layout -->
      <div style="display: flex;">
        <!-- Layout -->
        <div>
          <table>
            <tr>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
            </tr>
            <tr>
              <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>

我添加了overflow-x:auto;在表的父div上,你可以在這里找到更多關于表響應的細節,并為表添加了一些樣式,如填充,從我的角度來看,它是有效的。

th, td {
  text-align: left;
  padding: 10px;
}

<div>
  <div style="display: flex;">
    <!-- Layout -->
    <div style="display: flex;">
      <!-- Layout -->
      <div style="display: flex;">
        <!-- Layout -->
        <div style="overflow-x:auto;">
          <table>
            <tr>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
            </tr>
            <tr>
              <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
              <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
            <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>

試試add overflow-x:scroll;記住包括& ltmeta name = & quot視窗& quotcontent = & quotwidth =設備寬度,initial-scale = 1.0 & quot;& gt在腦海里。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    th, td {
    text-align: left;
    padding: 10px;
  }
  
  </style>
</head>
<body>

<div>
<h1>Title</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>

<div style="width:90%;" >
  <div style="display: flex;  overflow-x: scroll;">
    <!-- Layout -->
    <div style="display: flex;">
      <!-- Layout -->
      <div style="display: flex; ">
        <!-- Layout -->
        <div>
          <table>
            <tr>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
              <th>Name</th>
              <th>Age</th>
              <th>City</th>
              <th>Note</th>
            </tr>
            <tr>
              <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
              <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
            <td>Pepík zdenda z Brna</td>
              <td>245</td>
              <td>Sat Oct 10 1998 00:00:00 GMT+0200 (Central European Summer Time)</td>
              <td>Moc dlouha poznamka, ktera je fakt nesnesitelně dlouha</td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
  
</body>
</html>