1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

quick question about text colour

Discussion in 'PHP' started by dougvcd, Mar 13, 2009.

  1. #1
    i have this bit of code
    Echo "<b>END OF CATS LOST RECORDS <br> "
    PHP:
    how do i say which colour i would like to display say Red
    cheers
    Doug
    SEMrush
     
    dougvcd, Mar 13, 2009 IP
    SEMrush
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,063
    Likes Received:
    61
    Best Answers:
    3
    Trophy Points:
    225
    #2
    echo '<font color="red">Text string</font>';
    PHP:
     
    ActiveFrost, Mar 13, 2009 IP
  3. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #3
    well ya don't directly. You could use a font tag to wrap around it though that's deprecated. The "correct" way would be to wrap the text in a tag (options are P or DIV, span if its displayed inline) and assign a CSS class with a rule.
    CSS style goes into the head part of the page.
    
    <html><head>
    <style>
    .redtext  { color: maroon ; }
    </style>
    </head>
    <body>
    
    <?php
    echo "<p class='redtext'>END OF CATS LOST RECORDS </p>";
    ?>
    
    </body>
    </html>
    
    PHP:
    Now when you want anything to have redtext just assign it a class: redtext;.
     
    shallowink, Mar 13, 2009 IP
  4. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    big thanks
    to all
    Doug
     
    dougvcd, Mar 13, 2009 IP