hd.
hd.

Reputation: 18296

Fixed width in table

How can I fix the width of column in a table and make it be at a given width and not stretch with its content?

I have to say that I put width="300px" for example in <td> tag but not changes happen.

Upvotes: 1

Views: 383

Answers (3)

Linus Kleen
Linus Kleen

Reputation: 34612

Using explicit column sizing with colgroup usually works for me.

I have prepared a fiddle here.

Upvotes: 0

Shikiryu
Shikiryu

Reputation: 10219

Use :

<td width="300"></td>

or

<td style="width:300px"></td>

or

<td class="fixedCell"></td>

and

.fixedCell { width:300px; } /* In a CSS file. */

Upvotes: 2

Shakti Singh
Shakti Singh

Reputation: 86336

Replace with="300px" to width="300" and also table width should be more than the width of cell

Upvotes: 1

Related Questions