Salman Mushtaq
Salman Mushtaq

Reputation: 341

Make TH equals to 3 columns in HTML

enter image description hereHello, I want to make ACTIONS equal to three columns

As shown in image, I want ACTIONS in center of Detail Update Delete

Please help.

Upvotes: 0

Views: 262

Answers (2)

kyun
kyun

Reputation: 10274

<table border=1>
  <tr>
    <th>NAME</th>
    <th>AGE</th>
    <th colspan="3">ACTIONS</th>
  </tr>
  <tr>
    <td>Salman Mushtaq</td>
    <td>27</td>
    <td><a href="#">Detail</a></td>
    <td><a href="#">Update</a></td>
    <td><a href="#">Delete</a></td>
  </tr>
    <tr>
    <td>Muhanmmad Awais</td>
    <td>32</td>
    <td><a href="#">Detail</a></td>
    <td><a href="#">Update</a></td>
    <td><a href="#">Delete</a></td>
  </tr>
    </tr>
    <tr>
    <td>Imran Hassan</td>
    <td>38</td>
    <td><a href="#">Detail</a></td>
    <td><a href="#">Update</a></td>
    <td><a href="#">Delete</a></td>
  </tr>
  </tr>
    <tr>
    <td>Muhammad Asad</td>
    <td>33</td>
    <td><a href="#">Detail</a></td>
    <td><a href="#">Update</a></td>
    <td><a href="#">Delete</a></td>
  </tr>
  
</table>

Try to search about colspan and rowspan

Upvotes: 3

Marcx
Marcx

Reputation: 6836

Use colspan attribute in TH tag (ie. colspan="3")

        <table border="1">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Age</th>
                    <th colspan="3">Action (spanned 3 cols)</th>                        
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>2</td>
                    <td>action 1</td>
                    <td>Action 2</td>
                    <td>Action 3</td>
                </tr>
            </tbody>
        </table>

Upvotes: 1

Related Questions