yogi
yogi

Reputation: 19591

setting HTML table column width

I've got a simple table.

<table border="1" width="100%">
        <tr>
                <th>Select</th>
                <th>Name</th>
                <th>Preview</th>
        </tr>

How do I set the width so the Select and Preview be 15px and Name be rest of the width left ???

Upvotes: 1

Views: 2605

Answers (4)

Arun Kumar
Arun Kumar

Reputation: 303

<table border="1px" width="100%">
   <tr>
        <th width="15px">Select</th>
        <th>Name</th>
        <th width="15px">Preview</th>
   </tr>
</table>​​​​​​​​​​​​​​​​​​​​​

If you want to preview in any size screen according to their size, use '%' to determine the size. For ex

<table border="1px" width="100%">
   <tr>
        <th width="15%">Select</th>
        <th>Name</th>
        <th width="15%">Preview</th>
   </tr>
</table>​​​​​​​​​​​​​​​​​​​​​

Upvotes: 0

Rohit Azad Malik
Rohit Azad Malik

Reputation: 32182

Hey now you can define in your css as like this

Css

   .some{
    width:15px;
    }

HTML

<table border="1" width="100%">
        <tr>
                <th class="some">Select</th>
                <th>Name</th>
                <th  class="some">Preview</th>
        </tr>
</table>

live demo http://tinkerbin.com/n4Q1NOXW

Upvotes: 3

Hemant Metalia
Hemant Metalia

Reputation: 30648

you can use as

<table border="1" width="100%">
   <tr>
        <th width="15px">Select</th>
        <th>Name</th>
        <th width="15px">Preview</th>
   </tr>

Upvotes: 1

user1432124
user1432124

Reputation:

<table border="1" width="100%">
        <tr>
                <th width="15">Select</th>
                <th>Name</th>
                <th width="15">Preview</th>
        </tr>

Upvotes: 1

Related Questions