简体   繁体   English

表格宽度不适用于多行

[英]table width doesn't work on multiple row

http://jsfiddle.net/qse5owx6/ http://jsfiddle.net/qse5owx6/

Just sick, tried to debug this for an hour. 刚生病,尝试调试了一个小时。 Why the table is stretch by the content? 为什么表格会被内容拉伸? I have wrap the layout properly with tr and td . 我已经用trtd正确包装了布局。 I'm designing html for emails. 我正在设计用于电子邮件的html。

why the width:600px doesn't work on the table? 为什么width:600px在桌子上不起作用?

add table-layout: fixed; 添加table-layout: fixed;
Please see http://jsfiddle.net/qse5owx6/5/ 请参阅http://jsfiddle.net/qse5owx6/5/

see here jsfiddle 看到这里jsfiddle

well this happens because you've set specific fixed widths ( in pixels ) to all the elements , that's why you can't force the table to a smaller width. 发生这种情况的原因是,您已经为所有元素设置了特定的固定宽度(以像素为单位),这就是为什么不能将表格强制设置为较小的宽度。

i suggest you use percentages as widths for the elements inside the table. 我建议您使用百分比作为表格内元素的宽度。 for example 例如

tbody { width:100%;}
tr { width:100%;}
td { width:50%;}

OR if you want to keep the widths of the elements fixed (873px) you could wrap all the table inside a div like .wrapper and add 或者,如果您想保持元素的宽度固定(873px),则可以将所有表包装在div之类的.wrapper然后添加

.wrapper {
  width:600px;
  overflow:auto;
}

see here : jsfiddle 看到这里: jsfiddle

I did some research to create email templates. 我做了一些研究来创建电子邮件模板。

I hope this will help you in this. 希望对您有帮助。

The steps to create email templates are: 创建电子邮件模板的步骤是:

  1. Create the email template as per the guidelines of article 根据文章指南创建电子邮件模板
  2. Once the template is ready, transfer all CSS from css files to <style> in <head> 模板准备好后,将所有CSS从CSS文件传输到<head> <style> <head>
  3. Make all the CSS inline using service 使用服务使所有CSS内联
  4. To check which tag and CSS elements are valid for email client, please check link 要检查哪些标签和CSS元素对电子邮件客户端有效,请检查链接

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

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