How to set cell width and height in HTML?

HTMLWeb DevelopmentFront End Technology

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


Live Demo

<!DOCTYPE html>
         table, th, td {
            border: 1px solid black;
            <td style="height:100px;width:100px">Java</td>
            <td style="height:100px;width:100px">50</td>
Updated on 03-Oct-2019 09:05:30