Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade For Teachers Spaces Get Certified Upgrade For Teachers Spaces
   ❮     
     ❯   

HTML Tutorial

HTML HOMEHTML IntroductionHTML EditorsHTML BasicHTML ElementsHTML AttributesHTML HeadingsHTML ParagraphsHTML StylesHTML FormattingHTML QuotationsHTML CommentsHTML ColorsHTML CSSHTML LinksHTML ImagesHTML FaviconHTML Page TitleHTML TablesHTML ListsHTML Block & InlineHTML DivHTML ClassesHTML IdHTML ButtonsHTML IframesHTML JavaScriptHTML File PathsHTML HeadHTML LayoutHTML ResponsiveHTML ComputercodeHTML SemanticsHTML Style GuideHTML EntitiesHTML SymbolsHTML EmojisHTML CharsetsHTML URL EncodeHTML vs. XHTML

HTML Forms

HTML FormsHTML Form AttributesHTML Form ElementsHTML Input TypesHTML Input AttributesInput Form Attributes

HTML Graphics

HTML CanvasHTML SVG

HTML Media

HTML MediaHTML VideoHTML AudioHTML Plug-insHTML YouTube

HTML APIs

HTML Web APIsHTML GeolocationHTML Drag and DropHTML Web StorageHTML Web WorkersHTML SSE

HTML Examples

HTML ExamplesHTML EditorHTML QuizHTML ExercisesHTML WebsiteHTML SyllabusHTML Study PlanHTML Interview PrepHTML BootcampHTML CertificateHTML SummaryHTML Accessibility

HTML References

HTML Tag ListHTML AttributesHTML Global AttributesHTML Browser SupportHTML EventsHTML ColorsHTML CanvasHTML Audio/VideoHTML DoctypesHTML Character SetsHTML URL EncodeHTML Lang CodesHTTP MessagesHTTP MethodsPX to EM ConverterKeyboard Shortcuts

HTMLTables


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


Example

CompanyContactCountry
Alfreds FutterkisteMaria AndersGermany
Centro comercial MoctezumaFrancisco ChangMexico
Ernst HandelRoland MendelAustria
Island TradingHelen BennettUK
Laughing Bacchus WinecellarsYoshi TannamuriCanada
Magazzini Alimentari RiunitiGiovanni RovelliItaly
Try it Yourself »

Define an HTML Table

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

Example

A simple HTML table:

<table>
 <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
 </tr>
 <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
 </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
</table>
Try it Yourself »

Table Cells

Each table cell is defined by a<td> and a</td> tag.

td stands for table data.

Everything between<td> and</td> is the content of a table cell.

Example

<table>
 <tr>
    <td>Emil</td>
    <td>Tobias</td>
    <td>Linus</td>
 </tr>
</table>
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<tr> and ends with a</tr> tag.

tr stands for table row.

Example

<table>
 <tr>
    <td>Emil</td>
    <td>Tobias</td>
    <td>Linus</td>
 </tr>
 <tr>
    <td>16</td>
    <td>14</td>
    <td>10</td>
 </tr>
</table>
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<th> tag instead of the<td> tag:

th stands for table header.

Example

Let the first row be table header cells:

<table>
 <tr>
    <th>Person 1</th>
    <th>Person 2</th>
    <th>Person 3</th>
 </tr>
 <tr>
    <td>Emil</td>
    <td>Tobias</td>
    <td>Linus</td>
 </tr>
 <tr>
    <td>16</td>
    <td>14</td>
    <td>10</td>
 </tr>
</table>
Try it Yourself »

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



HTML Table Tags

TagDescription
<table>Defines a table
<th>Defines a header cell in a table
<tr>Defines a row in a table
<td>Defines a cell in a table
<caption>Defines a table caption
<colgroup>Specifies a group of one or more columns in a table for formatting
<col>Specifies column properties for each column within a <colgroup> element
<thead>Groups the header content in a table
<tbody>Groups the body content in a table
<tfoot>Groups the footer content in a table

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


Video: HTML Tables

Tutorial on YouTube
Tutorial on YouTube



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp