How do you print a table in html?

tag.

td stands for table data.

Everything between

are the content of the table cell.

Example


HTML tables allow web developers to arrange data into rows and columns.


Example

CompanyContactCountry
Alfreds Futterkiste Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy

Try it Yourself »


Define an HTML Table

A table in HTML consists of table cells inside rows and columns.

Example

A simple HTML table:


 
   
   
   
 
 
   
   
   
 
 
   
   
   
 
CompanyContact Country
Alfreds FutterkisteMaria Anders Germany
Centro comercial MoctezumaFrancisco Chang Mexico

Try it Yourself »


Table Cells

Each table cell is defined by a

and a and

 
   
   
   
 
EmilTobias Linus

Try it Yourself »

Note: A table cell can contain all sorts of HTML elements: text, images, lists, links, other tables, etc.



Table Rows

Each table row starts with a and ends with a tag.

tr stands for table row.

Example


 
   
   
   
 
 
   
   
   
 
EmilTobias Linus
1614 10

Try it Yourself »

You can have as many rows as you like in a table; just make sure that the number of cells are the same in each row.

Note: There are times when a row can have less or more cells than another. You will learn about that in a later chapter.


Table Headers

Sometimes you want your cells to be table header cells. In those cases use the tag instead of the tag:

th stands for table header.

Example

Let the first row be table header cells:


 
   
   
   
 
 
   
   
   
 
 
   
   
   
 
Person 1Person 2 Person 3
EmilTobias Linus
1614 10

Try it Yourself »

By default, the text in elements are bold and centered, but you can change that with CSS.


HTML Exercises


HTML Table Tags

TagDescription
element
Defines a table
Defines a header cell in a table
Defines a row in a table
Defines a cell in a table
Defines a table caption
Specifies a group of one or more columns in a table for formatting
Specifies column properties for each column within a
Groups the header content in a table
Groups the body content in a table
Groups the footer content in a table

For a complete list of all available HTML tags, visit our HTML Tag Reference.



How do I print just a table in HTML?

@media print {.
#printableTable {.

How do I print a table from a website?

Print Settings in Chrome Browser 1. Print pages by pressing Ctrl + P on the keyboard or click or tap the three-dot menu button from the top right of the Chrome window. 2. Choose Print from the menu.

How do you print something in HTML?

Printing an HTML Document.
Open a document in the HTML editor..
Do one of the following: On the main menu, click File > Print. Press CTRL+P. The document prints as it appears in the HTML editor, NOT as it appears in a browser..

What is the HTML code for table?

HTML Table Tags.