小编And*_*oke的帖子

无法更改 <thead>、<tr> 元素的边框半径

如何更改 thead 和 tr 元素的半径?我希望我的表格有圆角,但 border-radius 不适用于 thead 和 tr,但它适用于元素本身。这是CSS。

table{
    width:100%;
    border-radius:5px;
    background:gray;
}
thead {
    border-radius:5px;
    text-align:left;
    background:blue;
}
tr{
    border-radius:5px;
}
th,td{
    padding:5px;
}
Run Code Online (Sandbox Code Playgroud)

这是 HTML。

   <table>
     <thead>
        <tr>
        <th>No</th>
        <th>Name</th>
        <th>Country</th>
        <th>Age</th>
        </tr>
     </thead>
     <tbody>
        <tr>
        <td>1</td>
        <td>Andy</td>
        <td>UK</td>
        <td>40</td>
        </tr>
      </tbody>
      <tbody> 
    </table> 
Run Code Online (Sandbox Code Playgroud)

html css

1
推荐指数
1
解决办法
2134
查看次数

如何使网格中的项目适合一行?

我正在尝试使 3 个 div 适合网格。但是,我想将代码重用于可能有多个网格的其他网格。这是可能的还是我应该单独编写代码?

  <div class="div-wrapper">
    <div class="div1"></div>
    <div class="div2"></div>
    <div class="div3"></div>
  </div>

.div-wrapper{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  grid-gap:5px;
  width:100%;
  height:10vh;
  background:black;
}
Run Code Online (Sandbox Code Playgroud)

但是,我想将上面的代码用于内部超过 3 个 div 的其他包装器,例如

    <div class="div-wrapper">
      <div class="div1"></div>
      <div class="div2"></div>
      <div class="div3"></div>
      <div class="div4"></div>
      <div class="div5"></div>
    </div>
Run Code Online (Sandbox Code Playgroud)

html css css-grid

0
推荐指数
1
解决办法
1971
查看次数

标签 统计

css ×2

html ×2

css-grid ×1