简体   繁体   中英

Set th or td height in HTML for one column

I'm trying to set the <th> size for one column. I was trying something like

<th width=100> Description </th>

and the same for <tr> ( <tr width=100> )

The above does not resize the column at all.

You are attempting to use an inline style inside your HTML tags. First off, I recommend quotes around your units of measure like so. <th width="100"></th> Also, you arent defining the units of measure of the tags. you can use: <th width="100px"></th> or <th width="100%"></th> i think that you can even do inches and centimeters. Be careful when using the inline style `length' as the webpage is limitless....

Another way you can do this is using CSS. Inside your head tag could be a <style> tag. Inside you can do: .measure { width:100px; } .measure { width:100px; } Note it doesn't have to be pixels. Then on any tag you want 100px wide, you just do: <th class="width"></th> or <tr class="measure"></tr> . Hope this helps!

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