css - 表格单元格间距不均匀
问题描述
我正在制作一个电子邮件模板,因此我仅限于使用行内样式。问题是底部的社交媒体链接不会变得很好,甚至彼此之间会保持距离。看起来很糟糕。我怎样才能让它们之间有均匀的空间?谢谢
这是一个小提琴,如果你让视图更宽,就像在实际电子邮件中一样,它会更明显https://jsfiddle.net/89mnshyt/2/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="font-family: Arial;">
<div style="max-width: 80%; margin: auto;">
<div style="max-width: 100%; margin: auto;">
<a href="/"><img style="display: block; margin: auto;max-width: 300px;" src=""> </a> </div><br>
<div>It was a pleasure doing business with you. Your thoughts mean a lot to us. Your reviews help us learn what we are doing well, what we need to work on, and what we can do to make your experience with our company even better. </div>
<div> <span style="font-weight: bold;">Step 1: Follow the links or any (OR ALL!) of the review sites below </span><br><br>
Click the buttons below to go to that site and provide your review.</div>
<div><span style="font-weight: bold;">Give us a rating and review. </span> <br><br>
Choose a star rating and provide your comments.</div>
<h3 style="text-align: center;">THANK YOU!</h3>
<hr>
<table width="100%">
<tbody>
<tr><td width="20%"></td>
<td style="text-align: center;"><a href="" target="_blank"><img src="https://i.imgur.com/jmH8Emc.jpg"><br> Google</a></td>
<td style="text-align: center;"><a href="" target="_blank"><img src="https://i.imgur.com/2UcUbJB.png" ><br> Yelp</a></td>
<td style="text-align: center;"><a href="" target="_blank"><img src="https://i.imgur.com/1ngaDhv.png" ><br> Facebook </a></td>
<td style="text-align: center;"><a href="" target="_blank"><img src="https://i.imgur.com/y8BXkoK.jpg"><br> Car Gurus</a></td>
<td width="25%"></td>
</tr>
</tbody>
</table>
</body>
</html>
解决方案
您已将表格设置为 100%,但各个元素没有指定宽度。你可以这样做:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="font-family: Arial;">
<div style="max-width: 80%; margin: auto;">
<div style="max-width: 100%; margin: auto;">
<a href="/"><img style="display: block; margin: auto;max-width: 300px;" src=""> </a> </div><br>
<div>It was a pleasure doing business with you. Your thoughts mean a lot to us. Your reviews help us learn what we are doing well, what we need to work on, and what we can do to make your experience with our company even better. </div>
<div> <span style="font-weight: bold;">Step 1: Follow the links or any (OR ALL!) of the review sites below </span><br><br>
Click the buttons below to go to that site and provide your review.</div>
<div><span style="font-weight: bold;">Give us a rating and review. </span> <br><br>
Choose a star rating and provide your comments.</div>
<h3 style="text-align: center;">THANK YOU!</h3>
<hr>
<table width="100%">
<tbody>
<tr>
<td style="text-align: center;width:10%"></td>
<td style="text-align: center;width:20%"><a href="" target="_blank"><img src="https://i.imgur.com/jmH8Emc.jpg"><br> Google</a></td>
<td style="text-align: center;width:20%"><a href="" target="_blank"><img src="https://i.imgur.com/2UcUbJB.png" ><br> Yelp</a></td>
<td style="text-align: center;width:20%"><a href="" target="_blank"><img src="https://i.imgur.com/1ngaDhv.png" ><br> Facebook </a></td>
<td style="text-align: center;width:20%"><a href="" target="_blank"><img src="https://i.imgur.com/y8BXkoK.jpg"><br> Car Gurus</a></td>
<td style="text-align: center;width:10%"></td>
</tr>
</tbody>
</table>
</body>
</html>
我给了个人 20% 的宽度,并在两端添加了 10% 的垫片,我怀疑你试图这样做。
推荐阅读
- php - 为什么服务器响应加载资源失败:服务器响应状态为 500(内部服务器错误)?我该如何解决?
- nginx - 如何使用 Nginx 捕获反向代理错误?
- c++ - 在 Windows 中卸载延迟加载的 dll
- javascript - 用于翻译日期格式的 JavaScript
- python - 如何点击下一页
- javascript - React Hook:访问外部函数内部的状态
- python - Python Flask 将字符串从后端传递给 JavaScript
- mongodb - MongoDB:查找元素id在id数组中的元素
- ios - monospacedSystemFontOfSize:weight: 在 iOS 12 中不可用?
- flutter - 颤振开关通过点击而不是滑动改变值(无法获得焦点)