使用内联CSS复刻UI模板,修复头部、行间距问题并实现响应式
调整方案
核心修改说明
- 头部样式修正:移除表头单元格的浮动属性,改用text-align控制内容对齐,设置表头文字为白色、增加内边距,修正背景色匹配目标效果,同时开启表格边框合并避免重复边框线
- 行间距统一:为所有单元格设置统一的上下内边距和全局行高,取消零散的行高设置,保证左右列内容垂直对齐
- 响应式适配:表格设置100%宽度占满父容器,外层容器设置最大宽度限制大屏展示宽度、水平居中,单元格设置自动换行规则,小屏幕下内容不会溢出容器
- 细节优化:修正时区提示文字的加粗+斜体样式,调整学生笔记所在单元格的垂直对齐规则为顶部对齐,避免和左侧标签出现错位
完整代码(全内联样式)
<div style="max-width: 800px; margin: 20px auto; font-family: Arial, sans-serif; line-height: 1.6; padding: 0 16px;"> <div style="margin-bottom: 8px; font-size: 16px;"> Hello, Alice! Here are your appointments for the day: </div> <div style="font-style: italic; font-weight: bold; margin-bottom: 16px;"> All times are Arizona Time </div> <table style="border: 1px solid #e9e9e9; border-collapse: collapse; width: 100%;"> <thead> <tr> <th style="padding: 12px 16px; text-align: left; background-color: #666; color: #fff; font-weight: normal;">10:00AM - 10:30AM (30 MIN)</th> <th style="padding: 12px 16px; text-align: right; background-color: #666; color: #fff; font-weight: normal;">Abc</th> </tr> </thead> <tbody> <tr> <td style="padding: 10px 16px; width: 120px; font-weight: 500; vertical-align: top; border-bottom: 1px solid #e9e9e9;">Topic:</td> <td style="padding: 10px 16px; vertical-align: top; word-wrap: break-word; border-bottom: 1px solid #e9e9e9;">Resume Review</td> </tr> <tr> <td style="padding: 10px 16px; width: 120px; font-weight: 500; vertical-align: top; border-bottom: 1px solid #e9e9e9;">Phone:</td> <td style="padding: 10px 16px; vertical-align: top; word-wrap: break-word; border-bottom: 1px solid #e9e9e9;">1234567890</td> </tr> <tr> <td style="padding: 10px 16px; width: 120px; font-weight: 500; vertical-align: top; border-bottom: 1px solid #e9e9e9;">Email:</td> <td style="padding: 10px 16px; vertical-align: top; word-wrap: break-word; border-bottom: 1px solid #e9e9e9;">abc@gmail.com</td> </tr> <tr> <td style="padding: 10px 16px; width: 120px; font-weight: 500; vertical-align: top;">Student notes:</td> <td style="padding: 10px 16px; vertical-align: top; word-wrap: break-word;">Hello,<br> My resume is pretty ugly, I built it based on what I learned in TAPS in military out-processing.<br> I will be standing by for the phone call, I missed my last one because I mixed up the appointment time zone.</td> </tr> </tbody> </table> </div>
内容的提问来源于stack exchange,提问作者Rakesh
相关产品推荐
相关产品推荐

