Html how to make a table with multiple headers?

12,138

You can have different headers for different rows. There is a good example on the W3 site. If you have questions about markup validity, you can use the W3 validator web page to check your HTML.

Share:
12,138
kkkkk
Author by

kkkkk

:)

Updated on June 05, 2022

Comments

  • kkkkk
    kkkkk almost 2 years

    I want to make a table. I know how to make in html simple table. I want to have a few headers. A few types of header, similar to photo. I don't know number of it, I would count it in my program. What should I use, about what should I read?

    I tried this:

    <table border="1" width="100%">
    <tr>
        <th>AAA1</th>
        <th>AAA2</th> 
    </tr>
    <tr>
        <th>KKK1</th>
        <th>KKK2</th>
        <th>KKK3</th>
        <th>KKK3</th>
    </tr>
    
    <tr>
        <th>PPP1</th>
        <th>PPP2</th>
        <th>PPP3</th>
        <th>PPP4</th>
        <th>PPP5</th>
    </tr>
    </table>
    

    But I know it is too simple and will not give me something similar to picture. I read about colspan, but it will not give me a result which I want. Maybe there is a bootstrap for it?

    enter image description here