Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner HTML question - need help lining up text

Status
Not open for further replies.

FreakyLee

Programmer
Dec 9, 2001
3
0
0
US
OK, I am a beginner at HTML, so sorry if this is a stupid question. Part of the web page I'm working on has a section of text something like this:
Code:
SECTION 1                SECTION 2
Software Applications:   example1, example2, example3
Development Tools:       example1, example2, example3
Databases:               example1, example2, example3
Operating Systems:       example1, example2, example3
How do I get the text in Section 2 to align? I'm not having a problem with the text in Section 1, but the text in Section 2 is all skewed because HTML obviously ignores the whitespace between Section 1 and Section 2. Is a table the answer? If it is, can I make the Section 2 column dynamic in size? There will be n number of examples for each item, so I can't limit myself to a fixed size column.

Thx in advance.
 
Hi FreakyLee,

You don't have to apologize here. We all started like you and there are no stupid questions!!

I think a table is the best way.
If you only set the with of the table and cells you can get a nice result. If there are a lot of examples the heigth will be set automatically. Use the valign in the first cell to get the text on top.

<table border=1 width=&quot;500&quot;>
<tr>
<td width=&quot;200&quot;>
SECTION 1
</td>
<td width=&quot;300&quot;>
SECTION 2
</td>
</tr>
<tr>
<td valign=&quot;top&quot;>
Software Applications:
</td>
<td>
example1, example2, example3, example4, example5, example6, example7, example8, example9
</td>
</tr>
<tr>
<td valign=&quot;top&quot;>
Development Tools:
</td>
<td>
example1, example2, example3
</td>
</tr>
</table>

Hope this helps you on your start,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Boomerang is right, use a table to get your data columns to line up with each other. Tables are overused these days, but this is one case where tables are the perfect solution because you really are creating a table.

Another thing, for the table data (<td></td>) tags containing SECTION 1 and SECTION 2, use table head (<th></th>) tags instead, because that's basically what they are: headers.

You can ignore the rest of this post, but if you're interested, check into a technology called Cascading Style Sheets (CSS). It's super-easy to use and lets you control the look and feel of your page without writing a lot of HTML code.

Here's one among hundreds of tutorials out there:


Petey
 
A table worked beautifully. Thank you for your help! Also, wullie, I completely forgot about & n b s p. Thanks for reminding me!


FreakyLee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top