Why does my browser repeat this text back?

I have it written in PHP:

<?php global $current_user; get_currentuserinfo(); ?> <div style="float: right; text-align: right;"> <h4> <?php if ( is_user_logged_in() ) { echo 'Welcome: ' . $current_user->user_login; ?> </h4> <p> <?php echo '<a>My Classes</a> &nbsp;&brvbar;&nbsp; <a>Logout</a>'; } else { ?> </p> <h4> <?php echo 'Welcome, guest!'; ?> </h4> <p> <?php echo '<a>Login</a> | <a>Register</a>'; } ?> </p> </div> 

And my browser shows this:

 Welcome: Admin | LogoutMy Classes 

Why is this?

+4
source share
1 answer

In appearance, you have <a> tags placed on the right. In this case, the elements with the correct movement will always be added from right to left.

This means that the first element that moves to the right will be located on the far right edge, and the second element will float on the right, but the first element will sit on the left side. To fix this, you need to either (a) customize the CSS so that the <a> tags do not float to the right, or (b) re-order your echo statement to output "Exit" before you exit "My Classes".

+6
source

All Articles