引导4表行阴影

问题描述 投票:0回答:4

有没有一种方法来显示周围表行阴影与引导4?

我尝试以下,但阴影只出现在桌子外面:

<table>
<TR class="shadow p-3 mb-3 bg-white rounded">
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
</TR>
<TR class="shadow p-3 mb-3 bg-white rounded">
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
</TR>
<TR class="shadow p-3 mb-3 bg-white rounded">
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
  <TD>Table Cell</TD>
</TR>
</table>

见的jsfiddle https://jsfiddle.net/na6ohL0j/

twitter-bootstrap bootstrap-4 shadow
4个回答
0
投票

从你的HTML中删除shadow类,并在你的CSS添加以下内容:

tr { 
box-shadow: 0px 2px 18px 0px rgba(0,0,0,0.5);
display: block;
}

0
投票

最好的和最简单的方法是使用另一个表。然后,它适用的影子。

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row">
    <div class="col">
      <table class="w-100">
        <TR class=" bg-white rounded">
          <td>
            <table class="my-3 shadow w-100">
              <tr>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
              </tr>
            </table>
          </td>
        </TR>
        <TR class="bg-white rounded">
          <td>
            <table class="my-3 shadow w-100">
              <tr>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
              </tr>
            </table>
          </td>
        </TR>
        <TR class="bg-white rounded">
          <td>
            <table class="my-3 shadow w-100">
              <tr>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
                <TD class="p-3">Table Cell</TD>
              </tr>
            </table>
          </td>
        </TR>
      </table>

    </div>
  </div>
</div>

0
投票

这是不准确,但有些接近你想要的输出。尝试这个:

tr {
  box-shadow: 0 8px 16px rgba(0,0,0,.15)!important;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">

<div class="container">
  <div class="row">
    <table class="table">
      <thead>
        <tr>
          <th scope="col">Table Head</th>
          <th scope="col">Table Head</th>
          <th scope="col">Table Head</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Table Cell</td>
          <td>Table Cell</td>
          <td>Table Cell</td>
        </tr>
        <tr>
          <td>Table Cell</td>
          <td>Table Cell</td>
          <td>Table Cell</td>
        </tr>
        <tr>
          <td>Table Cell</td>
          <td>Table Cell</td>
          <td>Table Cell</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>

-1
投票
table {
  border-spacing: 0em 1em;
  padding: 0 2em 1em 0;
  border-collapse: separate;
}

td {
  width: 1.5em;
  height: 1.5em;
  text-align: center;
  vertical-align: middle;
}
© www.soinside.com 2019 - 2024. All rights reserved.