Home  >  Article  >  Web Front-end  >  How to display table body in HTML

How to display table body in HTML

WBOY
WBOYforward
2023-08-30 19:29:021067browse

How to display table body in HTML

Use the

tag in HTML to display the body of the table. The tag of HTML is used to add body to the table. The tbody tag is used together with thead tag and tfoot tag to identify each part of the table (title, footer, body).

The following are the attributes of the

tag: ##alignright##DEPRECATEDchar is deprecated charoff has been Deprecatedvalign#DEPRECATEDExample
Attributes

Value

Description

left

center

justify

char

- Visual alignment.

Character

- Specifies the characters on which to align the text. Used when align = "char".

pixels or %

- Specifies the alignment offset (expressed as a pixel or percentage value) from the first character. Used when align = "char".

top

middle

bottom

baseline

- Vertical alignment.

You can try running the following code to display the table body in HTML:

<!DOCTYPE html>
<html>
   <head>
      <title>HTML tbody Tag</title>
   </head>
   <body>
      <table style = "width:100%" border = "1">
         <thead>
            <tr>
               <td colspan = "4">This is the head of the table</td>
            </tr>
         </thead>
         <tfoot>
            <tr>
               <td colspan = "4">This is the foot of the table</td>
            </tr>
         </tfoot>
         <tbody>
            <tr>
               <td>Cell 1</td>
               <td>Cell 2</td>
               <td>Cell 3</td>
               <td>Cell 4</td>
            </tr>
            <tr>
               ...more rows here containing four cells...
            </tr>
         </tbody>
         <tbody>
            <tr>
               <td>Cell 1</td>
               <td>Cell 2</td>
               <td>Cell 3</td>
               <td>Cell 4</td>
            </tr>
            <tr>
               ...more rows here containing four cells...
            </tr>
         </tbody>
      </table>
   </body>
</html>

The above is the detailed content of How to display table body in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete