Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    712
    Thanks
    165
    Thanked 0 Times in 0 Posts

    add code for font size under php echo code

    Good day!

    I have a pure php code, so my table was in echo and I want to change the font and font-size of text in table header but when I put thid code:
    PHP Code:
    echo "<font size="18" face='Arial'>";
    echo 
    "<table>";

    and 
    at the lower part i close it
    echo "</table>";
    echo 
    "</font>"
    It only take effect in the text outside the table. and when I try to put it on the <table> It doesn't take effect.

    Thank you in advance

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    Try this
    PHP Code:
    echo '<table style="font-size:18px; font-family:Arial; color:red;"><tr><td>This is a test</td></tr></table>'
    so, as you can see I've added a css-styles for the table.
    you can also assign a class for a table and define styles for this class in your css-file
    or just put to your css-file for all tables something like:
    Code:
    table {
     font-size:18px;
     font-family:Arial;
    }
    Last edited by poyzn; 11-11-2010 at 07:26 AM.

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Yah, the font tag is outdated. If you need to modify visual elements, you now use CSS. And you're more often better then not putting CSS in an external file rather then inline.

  • #4
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    838
    Thanks
    15
    Thanked 9 Times in 9 Posts
    If it wasn't out of date... you would have needed to escape the quotes (or used single quotes) for it to work in any sort of way. However, the <font> never penetrates a table anyway and CSS is the only way to go nowadays.

    PHP Code:
    echo "<font size=\"18\" face='Arial'>"
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • Users who have thanked dniwebdesign for this post:

    newphpcoder (11-12-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •