

- 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 width and height in HTML?
To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn’t supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively.
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.
You can try to run the following code to set height and width to a table cell in HTML. We’re also using the <style> tag and the style attribute to style the table
Example
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>Tutorial</h1> <table> <tr> <th>Language</th> <th>Lessons</th> </tr> <tr> <td style="height:100px;width:100px">Java</td> <td style="height:100px;width:100px">50</td> </tr> <tr> <td>Ruby</td> <td>40</td> </tr> </table> </body> </html>
- Related Questions & Answers
- How to set viewport height and width in CSS
- How to use height and width attributes in HTML?
- How to use image height and width attribute in HTML Page?
- How to set cell padding in HTML?
- How to set width and height of an element using jQuery?
- How do I set browser width and height in Selenium WebDriver?
- How to set table width in HTML?
- How to set the height/width of a Label widget in Tkinter?
- How to set the min and max height or width of a Frame in Tkinter?
- How I can set the width and height of a JavaScript alert box?
- Width and Height of Elements in CSS
- The width and height properties in CSS
- How can I set an ImageView's width and height programmatically in Android?
- How to get the height and width of the android.widget.ImageView?
- Set the height and width of an image using percent with CSS
Advertisements