Jump to content

Problems aligning headers in table


cmccullough

Recommended Posts

Hello,I'm trying to create a table, of sorts, on my site but I can't seem to get the headers above the content. Also, I don't necessarily want it to look like a table where everything is "boxed" in but just a header above each piece of text. I've included the code that I'm using with the output. The "download link" text will be replaced with the actual download link when I get this set correctly. I would like the "download link" to be below the Newsletter and Menu headers but I just can't seem to figure out how to do it..<html><body><table border="0" width="100%" cellpadding="10"><tr><th>Newsletter</th><td width="50%" valign="top">Download Link</td><th>Menu</th><td width="50%" valign="top">Download Link</td></tr></table></body></html>Below is the output:Newsletter Download Link Menu Download LinkAlso, I was told that using CSS instead of HTML might be a better way of doing this? Would that be true?Thanks for your help!

Link to comment
Share on other sites

CSS does not replace HTML. They work together. And, yes, if you are getting serious about designing web pages, learning how to avoid table layouts and use CSS to style HTML elements is a good idea. The tutorials at W3Schools are a good start. This tutorial walks you through a very common design layout. It might not be what you're after, but it demonstrates some key principles.Your immediate problem is that you have all your elements in a single table row, so of course nothing lines up above anything else. Your basic pattern should be more like this (I left out the small details):

<table>   <tr>	  <th>header 1</th>	  <th>header 2</th>   </tr>   <tr>	  <td>content 1</td>	  <td>content 2</td>   </tr></table>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...