user3786609
user3786609

Reputation: 211

HTML table add header to each row

I want to create a table like

col1 | col2 | col3
**     **     **
col4 
****************

How should I write the html table tag?

Thank you so much

Upvotes: 0

Views: 516

Answers (4)

Todd Mark
Todd Mark

Reputation: 1885

JSFiddle

use colspan can achieve it.

<table>
    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
    </tr>
   <tr>
       <td colspan="3">head</td>
   </tr>
    <tr>
        <td>4</td>
        <td>5</td>
        <td>6</td>
    </tr>
</table>

Upvotes: 0

Joseph Ybholy
Joseph Ybholy

Reputation: 1

<table>
  <tr>
    <td>col1</td>
    <td>col2</td>
    <td>col3</td>
  </tr>
  <tr>
    <td>**</td>
    <td>**</td>
    <td>**</td>
  </tr>
  <tr>
    <td colspan="3">col4</td>
  </tr>
  <tr>
    <td colspan="3"> your text*</td>
  </tr>
</table>

Upvotes: 0

jagmitg
jagmitg

Reputation: 4566

Best Way - add a column Span to the merged.

<table>
  <tr>
    <th>*</th>
    <th>*</th>
    <th>*</th>
  </tr>
  <tr>
    <td colspan="3">***</td>
  </tr>
</table>

JSFIDDLE: http://jsfiddle.net/Lde2fwe7/

Upvotes: 0

Hatem
Hatem

Reputation: 369

Do it like this :

<table>
 <tr>
   <td>col1</td>
   <td>col2</td>
   <td>col3</td>
 </tr>
 <tr>
  <td>**</td>
  <td>**</td>
  <td>**</td>
 </tr>
 <tr>
  <td colspan="3">col4</td>
 </tr>
 <tr>
  <td colspan="3">*********</td>
 </tr>

</table>

Upvotes: 0

Related Questions