Reputation: 31709
I have this table, and I want to give a width to a th element, but it doesn't work..
<th style="width: 400px">
Room type
</th>
Any help?
Upvotes: 1
Views: 202
Reputation: 334
Due to your table being wide the width tag is not sufficient, use min-width instead.
<th style="min-width: 300px;" />
I would also recommend using colgroups if you are planning on setting a number of different widths in your headers - makes it easier to maintain and keeps it in one place.
Upvotes: 0
Reputation: 50193
Use min-width
, display: inline-block;
or display: block;
.
I think the first is the best...
Upvotes: 0
Reputation:
your table is too short to give width to the th.. delete some columns or just enlarge your table width. like:
<table width="2000px">
Upvotes: 0
Reputation: 157284
It does work, it's just that there's no room for the th
to get 300px
width, use min-width
instead
Upvotes: 3