Jump to content

Problems aligning headers in table


cmccullough
 Share

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>

Edited by Deirdre's Dad
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...