coreysnyder04 Posted February 20, 2009 Share Posted February 20, 2009 I have a table at the top of my site. It has 2 cells. The left cell is to say "Welcome USERNAME555" and It is to take up as much room in the table as necessary but be right aligned. The 2nd cell in the row will have a log out link. It is to always take just enough room to fit in the cell. That way the username field can expand without changing the placement of the stuff on the screen. Here is my code: echo "<table width='350'><tr> <td width='100%' align='right' class='Header'>Welcome " . $_SESSION['myusername'] . "</td> <td align='left' class='Header'><a href='forgotpass.html'>Logout</a></td> </tr></table>"; Now I run this and it looks like this: "Welcome USER5555 log out" Any ideas why that big ass gap is there?? Thanks, Corey Quote Link to comment https://forums.phpfreaks.com/topic/146044-formatting-issue/ Share on other sites More sharing options...
farkewie Posted February 20, 2009 Share Posted February 20, 2009 Hi, You may want to look at your CSS Class because when i display this <table width='350'> <tr> <td width='100%' align='right' class='Header'>Welcome USERHHH || </td> <td align='left' class='Header'><a href='forgotpass.html'>Logout</a></td> </tr> </table> It looks fine. Quote Link to comment https://forums.phpfreaks.com/topic/146044-formatting-issue/#findComment-766698 Share on other sites More sharing options...
shadiadiph Posted February 21, 2009 Share Posted February 21, 2009 your table width is 350 and you have made your first td element 100% so it is taking up as much of that tr td area make it into two rows or make your table smaller in length or change the td on the first bit to 50% echo "<table width='350'><tr> <td width='50%' align='right' class='Header'>Welcome " . $_SESSION['myusername'] . "</td> <td align='left' class='Header'><a href='forgotpass.html'>Logout</a></td> </tr></table>"; also your css header might be wrong why don't you include all width values in your css header class so maybe trysomethng like this .header{ width: 350px; height: auto; background: transparent; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; } .header .login{ width: auto; height: auto; text-align: right; padding: 0px 0px 0px 5px; margin: 0px 0px 0px 0px; } .header .logout{ width: auto; height: auto; text-align: left; padding: 0px 5px 0px 0px; margin: 0px 0px 0px 0px; } then echo "<table class='header'><tr> <td class='login'>Welcome " . $_SESSION['myusername'] . "</td> <td class='logout'><a href='forgotpass.html'>Logout</a></td> </tr></table>"; also add a font size family to the main .header element } Quote Link to comment https://forums.phpfreaks.com/topic/146044-formatting-issue/#findComment-767741 Share on other sites More sharing options...
Jurge Posted February 23, 2009 Share Posted February 23, 2009 shadiadiph is right you have told the cell in the table to take up 100% of the space it would be easier to do this with divs btw, just set it's width to inherit and sets it's max width to 350 in the css and it will change with out messing up. Quote Link to comment https://forums.phpfreaks.com/topic/146044-formatting-issue/#findComment-769047 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.