简体   繁体   中英

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 ? 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.

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. This one came up as the first result in 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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