首页 文章

为什么CSS [margin-right]没有在html中应用?

提问于
浏览
0

码:

table {
  border-radius: 3px;
  margin-top: 5px;
  margin-left: 5px;
  margin-right: 5px;
}
<div class="table-responsive-md">
  <table class="table table-striped table-bordered table-hover table-sm text-light">

    <caption>The todo-List</caption>

    <thead class="thead-dark">
      <tr>
        <th>#</th>
        <th>Date of Diclaration</th>
        <th>Date of Finish</th>
        <th>Target To Be Nailed</th>
      </tr>
    </thead>

    <tbody>
      <tr class="bg-primary">
        <td>1</td>
        <td>13 nov 1998</td>
        <td>13 nov 2019</td>
        <td>Meet her</td>
      </tr>
      <tr class="bg-dark ">
        <td>1</td>
        <td>13 nov 1998</td>
        <td>13 nov 2019</td>
        <td>Meet her</td>
      </tr>
    </tbody>
  </table>
</div>

我知道我要问你的事情会很愚蠢,但请帮助我!我无法为 table 设置保证金,而保证金左边工作正常,我试图将其改为保证金权利:50px或5%;但没有什么事情可以解决..所以请建议一些改变,以使它正确..谢谢

1 回答

  • 0
    .table-responsive-md{
      padding-left:5px;
      padding-right:5px;
    }
    
    <div class="table-responsive-md">
      <table class="table table-striped table-bordered table-hover table-sm text-light">
    
        <caption>The todo-List</caption>
    
        <thead class="thead-dark">
          <tr>
            <th>#</th>
            <th>Date of Diclaration</th>
            <th>Date of Finish</th>
            <th>Target To Be Nailed</th>
          </tr>
        </thead>
    
        <tbody>
          <tr class="bg-primary">
            <td>1</td>
            <td>13 nov 1998</td>
            <td>13 nov 2019</td>
            <td>Meet her</td>
          </tr>
          <tr class="bg-dark ">
            <td>1</td>
            <td>13 nov 1998</td>
            <td>13 nov 2019</td>
            <td>Meet her</td>
          </tr>
        </tbody>
      </table>
    </div>
    

    由于表是全宽,右边距不起作用 . 如果在父标记上使用左侧填充和填充,则可以执行所需操作 .

相关问题