简体   繁体   English

如何在表格的左侧和右侧添加阴影

[英]how do i add shadow on left and right side of column of table

can anyone please take a look at my code and can tell me how to use shadow box on both side of the column. 任何人都可以看看我的代码,并告诉我如何在列两边使用阴影框。 right now i have shadow on the column. 现在我在列上有阴影。 but its not seamless. 但它不是无缝的。 I want it to be exactly like the same i have for the column when i hover over it.If anyone have any suggestion please let me know. 我希望它与我将其悬停在栏上时完全一样。如果有人有任何建议,请告诉我。 Ty. TY。

  <style type="text/css">
    table {
    overflow: hidden;
  }

  td, th {
    padding: 10px;
    position: relative;
    outline: 0;
  }

  /* body:not(.nohover) tbody tr:hover {
    background-color: #ffa;
  } */

  td:hover::after,

  td:focus::after
   { 
    content: '';  
    height: 10000px;
    left: 0;
    position: absolute;  
    top: -5000px;
    width: 100%;
    z-index: -1;
  }

  td:hover::after,
  th:hover::after {
     background: #eff1f5;
      box-shadow: 0px -2px 21px 3px rgba(0, 0, 0, 0.23);
  }

  .active{
     background: #eff1f5;

    }
  td:focus::after,
  th:focus::after {
    background-color: lightblue;
  }

  /* Focus stuff for mobile */
  /* td:focus::before, */
  tbody th:focus::before {
    background-color: lightblue;
    content: '';  
    height: 100%;
    top: 0;
    left: -5000px;
    position: absolute;  
    width: 10000px;
    z-index: -1;
  }

  </style>


  <main>
    <table>
      <thead>
        <tr>
          <th></th>
          <th class="col active">50kg</th>
          <th class="col">55kg</th>
          <th class="col">60kg</th>
          <th class="col">65kg</th>
          <th class="col">70kg</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th class="row">160cm</th>
          <td class="active">20</td>
          <td>21</td>
          <td>23</td>
          <td>25</td>
          <td>27</td>
        </tr>

        <tr>
          <th class="row">165cm</th>
          <td class="active">18</td>
          <td>20</td>
          <td>22</td>
          <td>24</td>
          <td>26</td>
        </tr>
      <tbody>
    </table>
  </main>

codepen link if anyone like to view : https://codepen.io/ajitdas/pen/XMBoqZ Codepen链接(如果有人喜欢查看): https ://codepen.io/ajitdas/pen/XMBoqZ

How to get box-shadow on left & right sides only 如何仅在左侧和右侧获得阴影

This may help, it seems like the problem you may be having and there are multiple answers for different styles. 这可能会有所帮助,似乎您可能遇到了问题,并且针对不同样式有多个答案。

Hope this helps. 希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 CSS 和 Javascript 在我的侧面导航中添加从左到右的平滑滑动效果? - How do I add a smooth slide from left to right effect with CSS and Javascript on my side nav? (Grid js)我希望搜索按钮在右侧,添加按钮在左侧,我该怎么办? - (Grid js) I want the search button to be on the right side and the add button on the left, what do I do? 如何限制可拖动区域? 它在顶部和左侧起作用,但在右侧和底部不起作用 - How do I limit draggable area? it functions on top and left side, but not on the right side and bottom 如何使要滑动的图像从左侧0,0位置向右端移动到右侧? - How do i make the image to slide move to the right from left 0,0 position to the end right side? 如何将左连接的右侧添加为 PostgreSQL(nodeJS?)中的另一个“列” - How do you get the right side of a left join to be added as another 'column' in PostgreSQL (nodeJS?) 如何正确地从各个侧面(顶部,左侧,底部,右侧)创建2d对象碰撞 - How do I create 2d object collision from every side(top,left,bottom,right) properly 如何在JQuery中横向(从左到右,反之亦然)使图像褪色? - How do I make an image fade in sideways (left to right side & vice versa) in JQuery? 如何使用 Javascript 将 div 附加到另一个 div 的右侧或左侧? - How do I attach a div to the right or left side of another div using Javascript? 如何为横幅而不是向右,向左,向上和向下的列添加自定义列? - How can I add custom columns for banner instead of column right, left, top and bottom? 当我将鼠标悬停在div的左侧/右侧时,如何显示上一个/下一个按钮(使用CSS / jQuery) - When I hover left/right side of a div how do I display previous/next button (using CSS/jQuery)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM