简体   繁体   中英

table width doesn't work on multiple row

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 . I'm designing html for emails.

why the width:600px doesn't work on the table?

add table-layout: fixed;
Please see http://jsfiddle.net/qse5owx6/5/

see here 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

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

see here : 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>
  3. Make all the CSS inline using service
  4. To check which tag and CSS elements are valid for email client, please check link

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