Skip to content

Buzzingz

Unleashing the Power of Code

  • HTML
  • CSS
  • JavaScript
  • Toggle search form

HTML Tables

Posted on March 4, 2023April 1, 2023 By shani No Comments on HTML Tables

HTML tables are used to display data in rows and columns, similar to a spreadsheet. They are a powerful tool for presenting complex data in an organized and easy-to-read format.

To create a table in HTML, use the <table> element to define the table and the <tr> element to define each row. Within each row, use the <td> element to define each cell.

Below is a basic example of an HTML table:

<table>
  <tr>
    <th>Product Name</th>
    <th>Price</th>
    <th>Availability</th>
  </tr>
  <tr>
    <td>Product 1</td>
    <td>$10.00</td>
    <td>In Stock</td>
  </tr>
  <tr>
    <td>Product 2</td>
    <td>$20.00</td>
    <td>Out of Stock</td>
  </tr>
  <tr>
    <td>Product 3</td>
    <td>$30.00</td>
    <td>In Stock</td>
  </tr>
</table>

In this example, the <table> element is used to define the table, and each row is defined with the <tr> element. The first row is a header row, and the <th> element is used to define the header cells. The remaining rows are data rows, and the <td> element is used to define the data cells.

You can also add borders, padding, and other styles to your table using CSS. Here is an example of how to add a border to a table:

<style>
  table {
    border: 1px solid black;
  }
  th, td {
    padding: 10px;
    border: 1px solid black;
  }
</style>

This CSS code adds a 1-pixel black border around the entire table, and a 1-pixel black border around each cell. It also adds 10 pixels of padding to each cell to create some space between the content and the cell border.

HTML tables are a versatile and powerful tool for displaying data in a structured and organized format. With a little bit of CSS, you can create tables that are both functional and visually appealing.

HTML

Post navigation

Previous Post: HTML Favicon
Next Post: Table Borders

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

HTML Tutorial

  • HTML History
  • HTML Editors
  • What is an HTML Element?
  • HTML Attributes
  • HTML Headings
  • HTML Paragraphs
  • HTML Styles
  • HTML Text Formatting
  • HTML Quotation and Citation Elements
  • HTML Comments
  • HTML Colors
  • HTML Styles – CSS
  • HTML Links
  • HTML images
  • HTML Favicon
  • HTML Tables
    • HTML Table Colgroup
    • HTML Table Colspan and Rowspan
    • HTML Table Headers
    • HTML Table Padding and Spacing
    • HTML Table Sizes
    • HTML Table Styling
  • HTML List
  • HTML Ordered Lists
  • HTML Unordered List
  • HTML other lists
  • HTML Block and Inline Elements
  • HTML class Attribute
  • HTML id Attribute
  • HTML Iframes
  • HTML JavaScript
  • HTML File Paths
  • HTML – The Head Element
  • HTML Layout Elements and Techniques
  • HTML Responsive Web Design
  • HTML Computer Code Elements
  • HTML Semantic Elements
  • HTML Style Guide
  • HTML Entities
  • HTML Symbols
  • HTML Emojis
  • HTML Encoding (Character Sets)
  • HTML Uniform Resource Locators(URL)
  • HTML Versus XHTML
  • HTML Forms
  • HTML Form Attributes
  • HTML Form Elements
  • HTML Form Target Attribute
  • HTML Input Attributes
  • HTML Input form Attributes
  • HTML Input Types
  • HTML Canvas Graphics
  • HTML SVG Graphics
  • HTML Multimedia
  • HTML Video
  • HTML Audio
  • HTML Plug-ins
  • HTML YouTube Videos
  • HTML Geolocation API
  • HTML Drag and Drop API
  • HTML Web Storage API
  • HTML Web Workers API
  • HTML SSE API
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions

Copyright © 2023 Buzzingz.

Powered by PressBook WordPress theme