

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set cell padding in HTML?
Cell padding is the space between cell borders and the content within a cell. To set cell padding in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property padding.
HTML5 do not support the cellpadding attribute of <table>, so the CSS property padding is used with the style attribute to set cell padding.
Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
Example
You can try to run the following code to set cell padding in HTML. We’re also using the <style> tag and the style attribute to style the table
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>Programming Language</h1> <table> <tr> <th style="padding:10px">Language</th> </tr> <tr> <td style="padding:10px">Ruby</td> </tr> </table> </body> </html>
Output
- Related Questions & Answers
- How to set cell width and height in HTML?
- How to set the number of rows a table cell should span in HTML?
- HTML DOM Style padding Property
- How to set the padding of an element with JavaScript?
- How to set the padding of an Ellipse using FabricJS?
- How to set the padding of a Circle using FabricJS?
- How do we display a table cell in HTML
- How to set the right padding of an element with JavaScript?
- How to set the bottom padding of an element with JavaScript?
- How to set the left padding of an element with JavaScript?
- How to set the top padding of an element with JavaScript?
- How to set a value in a particular JTable cell with Java?
- How to set padding of all widgets inside a window or frame in Tkinter?
- How to set text direction in HTML?
- How to set background color in HTML?
Advertisements