Login Register
Code2night
  • Home
  • Guest Posts
  • Blog Archive
  • Tutorial
  • Languages
    • Angular
    • C
    • c#
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • Security
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
    • Word Counter
    • Base64 Encode/Decode
    • Diff Checker
    • JSON to CSV
    • Password Generator
    • SEO Analyzer
  1. Home
  2. Blogpost

Attribute of table in HTML

Date- Dec 09,2023

3029

In HTML, the <table> tag is used to create tables to display data in a structured grid format. The <table> tag can contain several attributes that help in defining and customizing the behavior and appearance of the table. Here are some commonly used attributes of the <table> tag:

  1. 1. border:

    • The border attribute is used to set the border width around the table and its cells.
    • Example: <table border="1">
  2. 2. cellpadding:

    • The gap between the cell content and the cell border is specified by the cellpadding attribute.
    • Example: <table cellpadding="5">
  3. 3. cellspacing:

    • The cellspacing attribute specifies the space between table cells.
    • Example: <table cellspacing="5">
  4. 4. width:

    • The width attribute specifies the table's width.
    • Example: <table width="100%">
  5. 5. height:

    • The height attribute sets the height of the table.
    • Example: <table height="200">
  6. 6. align:

    • The align attribute aligns the table with respect to the surrounding content (left, center, right).
    • Example: <table align="center">
  7. 7. summary:

    • The summary attribute provides a brief description of the table's content for accessibility purposes.
    • Example: <table summary="Monthly sales data">
  8. 8. bordercolor:

    • The bordercolor attribute sets the color of the table border.
    • Example: <table bordercolor="#CCCCCC">
  9. 9. bgcolor:

    • The bgcolor attribute sets the background color of the table.
    • Example: <table bgcolor="#F5F5F5">

Please note that while these attributes can be used for basic formatting, it's generally recommended to use CSS (Cascading Style Sheets) for styling HTML elements, including tables. CSS provides more control and flexibility for formatting and styling tables, and it separates the design from the content, making it easier to maintain and customize the appearance of the table.




S
Shubham Saini
Programming author at Code2Night — sharing tutorials on ASP.NET, C#, and more.
View all posts →

Related Articles

Responsive Slick Slider
Jul 28, 2022
How to add a WhatsApp share button on a website
Aug 22, 2022
Slick Slider with single slide
May 09, 2021
Code syntax higlighter using Prism js
Dec 12, 2020

Comments

Contents

More in HTML/CSS

  • Music Player 9306 views
  • How to create a table with fixed header and scrollable body 6379 views
  • Free PHP, HTML, CSS, JavaScript/TypeScript editor - CodeLobs… 4878 views
  • Child internet safety 4309 views
  • Registration Form In HTML 3978 views
View all HTML/CSS posts →

Tags

AspNet C# programming AspNet MVC c programming AspNet Core C software development tutorial MVC memory management Paypal coding coding best practices data structures programming tutorial tutorials object oriented programming Slick Slider StripeNet
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
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blog Archive
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
  • SEO Analyzer
Free Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Diff Checker
  • Base64 Encode/Decode
  • Word Counter
  • SEO Analyzer
By Language
  • Angular
  • C
  • c#
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • Security
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ·  Terms
Translate Page