Click to See Complete Forum and Search --> : align right
kproc
01-21-2007, 10:08 PM
hi. I want the link logout to move to the far right but I cannot get it to work
I tried, float and text align.
any ideas why
</div>
<?php if(isset($_SESSION['user_id'])){ ?>
<p style="background-color:#F1F1F1; font-style:italic; color:#4B4B4B; font-weight:bold; font-size:12px; margin-top:-10px; margin-bottom:10px;">Welcome <? echo $_SESSION['first_name'] ." ". $_SESSION['last_name']; ?><span style="text-align:right;"><a href="../logout.php">logout</a></span></p>
<?php } ?>
NightShift58
01-21-2007, 10:18 PM
Add the style attribute to <p>, as follows:<p style="text-align:right;background-color:#F1F1F1; font-style:italic; color:#4B4B4B; font-weight:bold; font-size:12px; margin-top:-10px; margin-bottom:10px;">Welcome <? echo $_SESSION['first_name'] ." ". $_SESSION['last_name']; ?><a href="../logout.php">logout</a></p>
kproc
01-21-2007, 10:19 PM
I want the welcome to stay on the left and the logout link to float to the right
felgall
01-21-2007, 10:36 PM
You can't align inline elements, only block elements and text within block elements can be aligned. Do it like this:
<div style="float:right;"><a href="../logout.php">logout</a></div>
<p style="background-color:#F1F1F1; font-style:italic; color:#4B4B4B; font-weight:bold; font-size:12px; margin-top:-10px; margin-bottom:10px;">Welcome <? echo $_SESSION['first_name'] ." ". $_SESSION['last_name']; </p>
kproc
01-21-2007, 10:49 PM
Thank you, for the help but I the float right does not align horizontally. the logout goes to the bottom.
NightShift58
01-21-2007, 10:54 PM
This seems to work with FF and IE:<p>
<div style="position:absolute;top:5px;left:1px;background-color:#F1F1F1;font-style:italic;color:#4B4B4B;font-weight:bold;font-size:12px;">LEFT</div>
<div style="position:absolute;top:5px;right:1px;background-color:#F1F1F1;font-style:italic;color:#4B4B4B;font-weight:bold;font-size:12px;">RIGHT</div>
</p>
NogDog
01-22-2007, 03:22 AM
You could either move the logout to the start of the paragraph and float it right...
<p style="background-color:#F1F1F1; font-style:italic; color:#4B4B4B; font-weight:bold; font-size:12px; margin-top:-10px; margin-bottom:10px;">
<span style="float:right;"><a href="../logout.php">logout</a></span>
Welcome <?echo $_SESSION['first_name'] ." ". $_SESSION['last_name'];?></p>
...or else float both parts of the paragraph separately...
<p style="background-color:#F1F1F1; font-style:italic; color:#4B4B4B; font-weight:bold; font-size:12px; margin-top:-10px; margin-bottom:10px;">
<span style="float:left;">Welcome <?
echo $_SESSION['first_name'] ." ". $_SESSION['last_name'];?></span>
<span style="float:right;"><a href="../logout.php">logout</a></span>
</p>