HTML table - Set the width to fit the screen

September 2017

HTML tables, spacing, borders, rows, columns; all of these are puzzling for any HTML newbie. If that's what you're looking for advice on, then you've come to the right place! HTML alignment tricks are very simple once you get the hang of them. This article will show the code needed to make an HTML table fit the screen by setting the width. Initially making the width 100% is standard for fitting on screen to justify further alignments. Now having content and links to the right, left or middle will be simplified by using a nested table. A nested table is an effective way to align the content, giving your table a structure.


My HTML table is driving me crazy; I want to get the table to fit the screen and I also want my links to be on the left, the content in the middle and have another bunch of links on the right. I'm new to HTML and I don't know how to achieve this.


I'll try to help. First set the width to 100%, so your code will actually look like this
<table width="100%" border="0" cellspacing="0" cellpadding="0">  
      <td>My html table is set to fit the screen</td>  

This little block of code will set the width to fit the screen. Now, if you want to have the content to the left, middle and to the right, the trick is to use a nested table.


Thanks to Net4me for this tip on the forum.


Published by aakai1056. Latest update on March 3, 2012 at 10:41 AM by Celia Gatward.
This document, titled "HTML table - Set the width to fit the screen," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (