Newbie Question About Setting Table Column Width

G

Guest

I'm new to web programming so please excuse my ignorance. With that said ...

I've added a 2-column, 3 row table to control the placement of everything on
the web page. The first row contains the header and spans the entire width.
The last row contains the footer and also spans the entire width.

I'm constructing a web page that has a header and footer across the entire
width of the page. Sandwiched in between these is the center row, which
contains a menu on the left and then the body of the page on the right.

I explicitly set the width of the left menu to 100 pixels and I didn't set
any width to the right column. I assumed that this would give the menu a
fixed width and only the width of the right column would change. But this
didn't happen. So what do I need to do?

I'm also wondering about something else: Can I programmatically change the
dimensions of the table? If so, how do I reference the various parts of the
table? I did add IDs to them but don't know how to reference them.
 
S

S. Justin Gengo

Robert,

You have to give your table a width. That width could be fixed, say 800
pixels or it could be a percent, say 90% you can play with that.

Here's the overall structure:

<table width="800">
<tr>
<td colspan="2">
Header
</td>
</tr>
<tr>
<td width="100px">
Menu
</td>
<td>
Body
</td>
</tr>
<tr>
<td colspan="2">
Footer
</td>
</tr>
</table>

Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Your comments prompted me to test something. I pulled the essential code out
of my aspx file and copied it into an aspx file on its own. here's the code:

<html>
<body>
<form id="HomePage" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="100%"
bgColor="lightsteelblue">
<tr bgColor="royalblue">
<td colSpan="2">Header</td>
</tr>
<tr>
<td id="LeftPanel" vAlign="top" align="center" width="124"
height="500" bgColor="aliceblue">Menu</td>
<td vAlign="top" bgColor="lightsteelblue" >
<h1>Home Page</h1>
<p>The content on this page is static and defined in the .ASPX
file.
</p>
</td>
</tr>
<tr>
<td colSpan="2">Footer</td>
</tr>
</table>
</form>
</body>
</html>


*This* version of the code works properly but the original one does not. I
really don't know what the difference is. Most mysterious!
 
S

S. Justin Gengo

Robert,

If you really need to know then send through both code examples and I'll
take a look and try to spot the difference, but if you have a working
version you should be all set (I hope).

Happy coding,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top