Text color in php
Solved
martine et chantal
Posted messages
517
Status
Membre
-
bat -
bat -
Hello,
I know how to change the color of text like this:
echo '<font color="red">hello</font>';
But how do I do it for a variable?
echo '<font color="red">hello</font>'.$variable;
Configuration: Windows XP / Internet Explorer 8.0
I know how to change the color of text like this:
echo '<font color="red">hello</font>';
But how do I do it for a variable?
echo '<font color="red">hello</font>'.$variable;
Configuration: Windows XP / Internet Explorer 8.0
6 réponses
Hello,
DO NOT USE FONT ANYMORE !!!!!!
It's over! Bearkk! not pretty....
A general rule: any element that affects the presentation of the page (color, size, etc...) should be managed in a style. Example, an alert text,
before:
<b><font color='red'>ALERT</font></b>
now:
<b style='color: red;'>ALERT</b>
For PHP:
<?php
$color = 'red';
?>
<b style='color: <?php echo $color; ?>;'>ALERT</b>
A+
DO NOT USE FONT ANYMORE !!!!!!
It's over! Bearkk! not pretty....
A general rule: any element that affects the presentation of the page (color, size, etc...) should be managed in a style. Example, an alert text,
before:
<b><font color='red'>ALERT</font></b>
now:
<b style='color: red;'>ALERT</b>
For PHP:
<?php
$color = 'red';
?>
<b style='color: <?php echo $color; ?>;'>ALERT</b>
A+
<span class="grasrouge">ALERT</span>
css => .grasrouge{font-weight:bold;color:red;}
Varaldi Q, we could also embed the CSS code in the tag:
In mpmp93's case, we could even simply replace the <b> tag with the <strong> tag.