Jump to content

Formatting issue


coreysnyder04

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/146044-formatting-issue/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/146044-formatting-issue/#findComment-766698
Share on other sites

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

 

 

 

 

}

Link to comment
https://forums.phpfreaks.com/topic/146044-formatting-issue/#findComment-767741
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.