Jump to content

This has got to be an html bug.


play_

Recommended Posts

Ok.

Page that works fine: http://decay.nu/helps/1.php

Page what works not so fine: http://decay.nu/helps/0.php

 

Look at the source code. it's fairly simple.

 

I'd like to know why is it that when i set the table border to 0, the table expands 100%. (second link)

But when i set it to 1, it works the way i want to. (first link)

 

???

 

 

 

ps: im using an HTML table layout because CSS is very skimpy on vertical aligning.

I do realize it's not hard if the centered div has a fixed height, but in this case the center div's height is in %, therefore i couldn't

figure out a way to vertical align using css.

Link to comment
Share on other sites

Because you are using empty <td></td> tags. Your web browser will ignore empty table cells.

 

What you should so is remove all empty cell tags and use the following CSS for your table (main_table class):

.main_table {
width: 50%;
height: 100%;
margin: 0 auto;  /* Center table in middle of page, no need for empty table cells */
}

Remove width: 50%; for .content.

 

As for vertical alignment with css. There are many articles out there that show you have to, Heres one and many others

Link to comment
Share on other sites

Wildteen88 is, of course, correct. The empty cells are indeed the issue.

 

But, rather than change the css (which is a good idea anyway), I find it best to avoid (when possible) having any empty containers  (<div>, <p>, <li> or <td>).

 

If you place a   in all of your empty <td> tags, the stretch issue also goes away - like so:

 

<td> </td>

Link to comment
Share on other sites

TABLES ARE NOT FOR LAYOUT!!!!

 

I am amazed that so many still use it - lets face it the hardest problems to solve (in terms of time requirement) in this section of the forums is nearly always due to a table layout...

 

Those who use tables becasue they don't know css layouts - GO AND LEARN - it will be the best thing you ever did in web development!

Link to comment
Share on other sites

TABLES ARE NOT FOR LAYOUT!!!!

 

I am amazed that so many still use it - lets face it the hardest problems to solve (in terms of time requirement) in this section of the forums is nearly always due to a table layout...

 

Those who use tables becasue they don't know css layouts - GO AND LEARN - it will be the best thing you ever did in web development!

 

I never thanked you toonmariner for yelling at me to go learn css. I listened to your kind words of wisdom and HEY it works even better than before! Css is alot easier than tables. Tables scare me now. They are unpredicatable and crazy (extra) code.

 

Everyone should listen to those words!

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.