A table is an excellent way to present a lot of information in an organized way, allowing users to understand it easier by seeing how data points relate to one another. After creating an HTML table you should add a border to it, as borders not added by default. First table is only 100 pixel width in any changes in browser window state, while other table will always stretch the full width of the window it is viewed in, that is the table automatically expands as the user changes the window size when you set width in % . Not a member of Pastebin yet? In HTML, there are two ways of adding a border to your tables.


The above HTML code display two tables, one is 100 pixel width and another one is 100% width. Just keep in mind, the usage of style attribute overrides any style set globally. Theoretically, we can make use of the nesting tr and td-elements to place the left and right corners of the table without adding additional markup. Unfortunately, IE 6 goes berserk and the table appears ugly, so the most stable way to do this is to put ID or class to all four corner cells of the table. middle ~ The content is aligned in the vertical center of the table cell (default value). You can try to run the following code to center align text in table cells in HTML… It will override any style set in the HTML