HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Displaying a fixed width in table, regardless of the content
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table
View previous topic :: View next topic  
Author Message
jburns131



Joined: 18 Oct 2005
Posts: 5

PostPosted: Tue Oct 18, 2005 3:30 pm     Displaying a fixed width in table, regardless of the content Reply with quote

I am trying to make a basic webpage layout, a banner/logo on top that streches all the way across the top, under that I want to have 2 sides that are about 20% of the pages width on either side, and I want to have the middle section to have a width of 60%. I think that's a very basic setup, but if I use the following code, the middle and sides only display the width of the content that I place inside it.

Code:


<body>

<table class='logo'>
    <tr>
        <td>
        &nbsp;
        </td>
    </tr>
</table>
<br />

<table bgcolor='#F9F9F9'>
    <tr>
        <td width='20%'>
        Left Side
        </td>
        <td width='60%'>
            <table bgcolor='#E9E9E9'>
                <tr>
                    <td>
                        This is the middle
                    </td>
                </tr>
            </table>
        </td>
        <td width='20%'>
        Right Side
        </td>
    </tr>
</table>

</body>



I want the middle and sides to stay the same sizes (20%, 60%, 20%) regardless of the content. What am I doing wrong?
Superpetauction



Joined: 07 Oct 2005
Posts: 47
Location: Logansport, Indiana

PostPosted: Tue Oct 18, 2005 4:11 pm     Re.. Reply with quote

is this what you are asking?
Code:

<table class='logo' width="100%">
    <tr>
        <td>
        &nbsp;
        </td>
    </tr>
</table>
<br />
<table bgcolor='#F9F9F9' width="100%">
    <tr>
        <td width='20%'>
        Left Side
        </td>
        <td width='60%'>
            <table bgcolor='#E9E9E9' width="100%">
                <tr>
                    <td>
                        This is the middle
                    </td>
                </tr>
            </table>
        </td>
        <td width='20%' width="100%">
        Right Side
        </td>
    </tr>
</table>
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8256
Location: Castle Rock CO USA

PostPosted: Tue Oct 18, 2005 4:28 pm     Reply with quote



It seems you are using XHTML? bgcolor is not supported by XHTML. For proper coding - we would need to know what the properties you have applied to the logo table.
jburns131



Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Oct 19, 2005 8:01 am     Reply with quote

Thanks Superpetauction, that's exactly what I was looking for. Smile

And Corey, I'm still learning the differences between html and xhtml, but I don't think the class 'logo' and bgcolor have anything to do with the width of columns (I know, unless I'm using attributes that effect the layout), but I could be wrong. Let me know. And anyways, I want the width to be constant regardless of any attributes/styles I implement (other than layout styles).

And I admit, I have been shying away from css untill I have a better grasp on just basic html/xhtml, is this not a good idea?

Thank you both for the responses, I was racking my brain for hours yesterday trying to get this right.
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8256
Location: Castle Rock CO USA

PostPosted: Wed Oct 19, 2005 8:29 am     Reply with quote

The reason I as asking - I did not know if you had a width / height in the logo class
jburns131



Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Oct 19, 2005 9:01 am     Reply with quote

Cool, that's what I thought. I am using an existing css, but it just defines colors and images, not width / hight. But I will look for those kind of things if using an existing css.
jburns131



Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Oct 19, 2005 9:08 am     Reply with quote

After looking at that code from Superpetauction alittle closer, I'm alittle confused about the last <td>, it has 2 width attributes. Does one override the other? Not sure of the logic that is happening there. Could anyone elaborate? Thanks.
jburns131



Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Oct 19, 2005 9:24 am     Reply with quote

I think I figured it out. I probably need to add another table in the <td> with a width of '100%', and get rid of the width='100%' in the <td> itself. Let me know if I'm right.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial