简体   繁体   English

向表的所有侧面添加CSS投影

[英]Adding CSS drop shadow to all sides of table

This is advice for a beginner, please do not tell me why I shouldn't use tables. 这是给初学者的建议,请不要告诉我为什么我不应该使用表。

How do I add a drop shadow to all edges of my table using CSS ? 如何使用CSS将阴影添加到表格的所有边缘? also where should I put it? 还应该放在哪里? and how do I link it to the table? 以及如何将其链接到表格?

<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>

You can use the CSS box-shadow property. 您可以使用CSS box-shadow属性。

box-shadow: 8px 5px 5px 0px #aaa;

If you are not comfortable with CSS yet then there are a few websites that do it for you. 如果您对CSS不满意,那么有一些网站可以为您提供帮助。 This one came up as the first result in Google. 是Google的第一个结果。

So, everything together would look something like this: 因此,所有内容合起来看起来像这样:

<style>
  table {
    -webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75);
    -moz-box-shadow:    7px 7px 5px 0px rgba(50, 50, 50, 0.75);
    box-shadow:         7px 7px 5px 0px rgba(50, 50, 50, 0.75);
  }
</style>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
</table>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM