Ask a question »

HTML table - Set the width to fit the screen

July 2015

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.

HTML table - Set the width to fit the screen




Issue


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.

Solution


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">  
<tr>  
      <td>My html table is set to fit the screen</td>  
</tr>  
</table>


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.

Note


Thanks to Net4me for this tip on the forum.
For unlimited offline reading, you can download this article for free in PDF format:
Html-table-set-the-width-to-fit-the-screen.pdf

See also

In the same category

Published by aakai1056. - Latest update by Celia Gatward
This document entitled « HTML table - Set the width to fit the screen » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.