Skip to content Skip to sidebar Skip to footer

Td Taking Up Entire Width Of Row

I need to set up an HTML table for an email in which each column has a set width. The left column is just an image and the right is to have text. I have set td width but the td ren

Solution 1:

You can use style="display:inline-block" in this case and use float:left as Leo Abraham has stated.

Solution 2:

You have an uneven number of columns in each row. On td elements that you wish to span both columns, specify a colspan attribute of the number of columns to be spanned.

JSFiddle

<tdalign="center"style="text-align:center;"width="600"colspan="2">

Edit:

Without this colspan attribute, each subsequent row's first column is assuming the width of the widest cell in the column - in this case the 600px wide first column of the first row.

Solution 3:

Add the style

float:left

to both TD and try. DEMO

Solution 4:

Solution 5:

Try adding this style to your table.

table-layout:fixed;

The default value is "auto" which I think is (weird) updated behavior, compared to the classic way of doing tables from 1994-2004.

https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout

I'm still not sure why "auto" forces a "td" to take up an entire row, when then content is much smaller than the width of the table. Does the "auto" engine have some glitches or weird behavior? Not sure.

Post a Comment for "Td Taking Up Entire Width Of Row"