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
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
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
Share on other sites

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.