Jez Jez - 5 months ago 9
CSS Question

Remove line break with new <p> tags

I have this PHP code on my website:

<?php
$usernametext = "<p style=" . '"' . "color:#969CB3;font-size:120%" . '"' . ">Username: </p>" . "<p style=" . '"' . "color:black;font-size:150%" . '"' . ">";
echo $usernametext . htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8');
?>


But this is what it displays as. I want it to be on one line and display like this.

The < p> tags (with styling) create a line break (or two) which I dont want. I have tried to put the tags out of the PHP and had no luck. Is this possible to do?

Answer

Use span tag instead of p tag

<?php
$usernametext = "<span style=" . '"' . "color:#969CB3;font-size:120%" . '"' . ">Username: </span>" . "<span style=" . '"' . "color:black;font-size:150%" . '"' . ">";
echo $usernametext . htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8');
?>
Comments