Tables In HTML | Code2night.com
Code2night
  • Home
  • Blogs
  • Guest Posts
  • Tutorial
  • Post Blog
  • Register
  • Login
  1. Home
  2. Blogpost

Tables In HTML

Date- Dec 09,2023

3210

Creating tables in HTML is a way to display tabular data in a structured format. HTML provides several elements for building tables, including the <table>, <tr>, <th> and <td> elements. Here's how to create a simple HTML table:

In this example,

<html>

<head>

    <title>HTML Table Example</title>

</head>

<body>

    <h2>Sample Table</h2>

    <table border="1">

        <tr>

            <th>Heading 1</th>

            <th>Heading 2</th>

            <th>Heading 3</th>

        </tr>

        <tr>

            <td>Row 1, Column 1</td>

            <td>Row 1, Column 2</td>

            <td>Row 1, Column 3</td>

        </tr>

        <tr>

            <td>Row 2, Column 1</td>

            <td>Row 2, Column 2</td>

            <td>Row 2, Column 3</td>

        </tr>

        <tr>

            <td>Row 3, Column 1</td>

            <td>Row 3, Column 2</td>

            <td>Row 3, Column 3</td>

        </tr>

    </table>

</body>

</html>


a). The '<table>' element is used to define the table.

b). For viewing purposes, the border="1" parameter creates a border around the table and its cells. It's not recommended for production use; CSS is preferred for styling.

c). The <tr>  elements define table rows. Each '<tr>'  represents a new row in the table.

d). The '<th>'  elements define table headers, which are displayed in bold by default and centered.

e). The '<td>'  elements define table data cells, which contain the actual data.

More rows and columns can be added as needed. You can also use CSS to style the table, change the border style, and format the table according to your design preferences.





Tables in HTML are commonly used to display data in a structured format, such as product listings, schedules, and data summaries. They are an essential part of web development for organizing and presenting tabular data.

Example:-

<html>

<head>

    <title>HTML Table Example</title>

</head>

<body>

    <h2>Example of Table</h2>

    <table border="2" width=50% align=center bgcolor=yellow height=50% border-color=red cellspacing=10 cellpadding=20>

        <tr bgcolor=orange>

            <th>Roll No.</th>

            <th>Name</th>

            <th>Marks</th>

        </tr>

        <tr>

            <td>101</td>

            <td>herry</td>

            <td>546</td>

        </tr>

        <tr>

            <td>102</td>

            <td>robin</td>

            <td>489</td>

        </tr>

        <tr>

            <td>103</td>

            <td bgcolor=red>joy</td>

            <td>800</td>

        </tr>

    </table>

</body>

</html>


Result:-


Table Attribute will be discussed later.


Comments

Tags

Swagger UI
Swashbuckle
SwashbuckleAspNetCore
Rest API
Postman
Api Testing
ITextSharp
Export to Pdf
AspNet Core
AspNet
C#
View to Pdf in Aspnet
Scheduler
Fibonacci series in Java
Display Fibonacci Series
First C# Program
What is C?
C
C Programming
CodeLobster
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Panipat
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2026 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Terms & Conditions
  • Refund Policy
  • About Us
  • Privacy Policy
  • Json Beautifier
  • Guest Posts