chanfuterboy Posted August 17, 2009 Share Posted August 17, 2009 hi, echo 1 to 3, need to be center, and echo 4 need to be right, they are in the same line. how i can put it without use-ing i try <td> also but seems not getting it help me echo "<p align='center'>[<a href='profile.php' target='mFrame'>Profile</a>] "; echo "[<a href='profile.php' target='mFrame'>P.M</a>] "; echo "[<a href='profile.php' target='mFrame'>Add Friends</a>] "; echo "Welcome, ".$_SESSION['username']. "[<a href='logout.php'>Logout</a>]"; Link to comment https://forums.phpfreaks.com/topic/170723-php-align/ Share on other sites More sharing options...
chriscloyd Posted August 18, 2009 Share Posted August 18, 2009 well start off trying to use divs to place your information example <div id="main_content"> <div id="center" style="align:center"><?=echo "<p align='center'>[<a href='profile.php' target='mFrame'>Profile</a>] ";?></div> <div id="center" style="align:center"><?=echo "<p align='center'>[<a href='profile.php' target='mFrame'>Profile</a>] ";?></div> <div id="center" style="align:center"><?=echo "[<a href='profile.php' target='mFrame'>Add Friends</a>] ";?></div> <div id="right_side" style="float:right"><?=echo "Welcome, ".$_SESSION['username']. "[<a href='logout.php'>Logout</a>]";?></div> </div> Link to comment https://forums.phpfreaks.com/topic/170723-php-align/#findComment-900836 Share on other sites More sharing options...
trq Posted August 18, 2009 Share Posted August 18, 2009 well start off trying to use divs to place your information example <div id="main_content"> <div id="center" style="align:center"><?=echo "<p align='center'>[<a href='profile.php' target='mFrame'>Profile</a>] ";?></div> <div id="center" style="align:center"><?=echo "<p align='center'>[<a href='profile.php' target='mFrame'>Profile</a>] ";?></div> <div id="center" style="align:center"><?=echo "[<a href='profile.php' target='mFrame'>Add Friends</a>] ";?></div> <div id="right_side" style="float:right"><?=echo "Welcome, ".$_SESSION['username']. "[<a href='logout.php'>Logout</a>]";?></div> </div> You cannot have multiple divs all with the same id. Link to comment https://forums.phpfreaks.com/topic/170723-php-align/#findComment-900842 Share on other sites More sharing options...
chriscloyd Posted August 18, 2009 Share Posted August 18, 2009 weird i do and it works perfectly haha Link to comment https://forums.phpfreaks.com/topic/170723-php-align/#findComment-900888 Share on other sites More sharing options...
haku Posted August 18, 2009 Share Posted August 18, 2009 It's invalid code. It's also divitis - there is no reason for that many divs at all. One div wrapping all of those <p> tags is enough. If each <p> tag needs to be styled separately, it can be given it's own class. And finally, making an ID or class name be a description of the styling is not a good practice, as at some point in the future, the styling may change. For example, the three p tags that are left aligned may need to be switched to a right alignment at some time, at which point having an ID or class named 'left' doesn't make a lot of sense. Link to comment https://forums.phpfreaks.com/topic/170723-php-align/#findComment-900959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.