play_ Posted September 8, 2007 Share Posted September 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 8, 2007 Share Posted September 8, 2007 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 Quote Link to comment Share on other sites More sharing options...
play_ Posted September 8, 2007 Author Share Posted September 8, 2007 Thanks wildteen. Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted September 8, 2007 Share Posted September 8, 2007 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> Quote Link to comment Share on other sites More sharing options...
php_joe Posted September 11, 2007 Share Posted September 11, 2007 can't you also use border-collapse:separate;empty-cells:show; in your CSS to show empty cells? Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted September 12, 2007 Share Posted September 12, 2007 can't you also use border-collapse:separate;empty-cells:show; in your CSS to show empty cells? Not cross browser compatible. Besides, if you are using xhtml, you shouldn't have any empty cells anyway for it to be standards valid. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 12, 2007 Share Posted September 12, 2007 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! Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted September 13, 2007 Share Posted September 13, 2007 Wise words ... LISTEN TO HIM! Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted September 17, 2007 Share Posted September 17, 2007 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! Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 17, 2007 Share Posted September 17, 2007 Awwwwwwww - thanks guys... I've gone and got all emotional - its a wonderful feeling to think you have in some small way participated in enriching the lives of others... God bless every layout convert... Quote Link to comment Share on other sites More sharing options...
play_ Posted October 24, 2007 Author Share Posted October 24, 2007 I don't use it for layout. just in this one case i was experimenting, because it literally could not be done with plain css. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.