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.

How to set default font face for all website in php?

Discussion in 'PHP' started by globalcashsite, Dec 15, 2009.

  1. #1
    Guys

    I am developing a small php based website and wish to set "Arial" font for all php files/site. Right now I have to set this in all tables individually. Please help me how I can set font style at one place so if I change style from there it change in all files?

    GCS
     
    globalcashsite, Dec 15, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Create a CSS file and use it there php isnt what u need for such a thing u have to play with html
     
    Bohra, Dec 15, 2009 IP
  3. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #3
    If you haven't explicitly defined font's for various elements, setting font for body should do the trick.

    body
    {
    font-family: Arial;
    }
     
    mastermunj, Dec 15, 2009 IP
  4. AlexKey

    AlexKey Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    To be 100% sure, I think:
     
    AlexKey, Dec 15, 2009 IP
  5. shiva9675

    shiva9675 Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hmm.. if you have designed too many tables and used inline font styles, you could try replacing them and then applying the css tricks.. or use javascript ( jquery ) to find all tags with table and set the font style to Arial. I think the document is loaded, styles applied and then javascript on load is run. so at first the fonts may show up as the original one you have set but later on they will just show as Arial.. Let us know how you got through.

    Cheers
     
    shiva9675, Dec 15, 2009 IP
  6. masterofweb

    masterofweb Greenhorn

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    paste these lines in your CSS file..

    body {font-family:Arial;}
    table {font-family:Arial;}
    table tr {font-family:Arial;}
    table tr td{font-family:Arial;}


    your all page set in arial font..

    thanks
     
    masterofweb, Dec 17, 2009 IP
  7. believer1984

    believer1984 Peon

    Messages:
    1,544
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    or simplified:

    body, table, table tr, table tr td{font-family:Arial;}

    :)
     
    believer1984, Dec 17, 2009 IP
  8. zodiac

    zodiac Peon

    Messages:
    2,661
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    0
    #8
    ;)

    you may want backup fonts like AlexKey posted.if the user doesn't have arial it goes to the second one or third and so on.
     
    zodiac, Dec 17, 2009 IP
  9. KEEP IT REAL

    KEEP IT REAL Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Everyone have Arial
     
    KEEP IT REAL, Dec 17, 2009 IP
  10. xmart

    xmart Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    you must link the style sheet file with every php files instead of putting css in head of every file. Or else if you're creating dynamic sites then you need to link to the header file of PHP.
     
    xmart, Dec 18, 2009 IP
  11. markowe

    markowe Well-Known Member

    Messages:
    1,136
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    165
    #11
    Yeah, this is not the way to get a site-wide format change - that's what CSS is for! In fact, NO formatting should be done in PHP if at all possible. We want programming and web design kept well away from each other!

    Even if other pages have differing styles, there should still be a base CSS stylesheet which defines all those default values and is specified for each page - that bit COULD be done in PHP, though no need. You just include
    <link rel="stylesheet" type="text/css" href="defaultstylesheet.css" />
    HTML:
    ...or whatever the file is called, in your HTML header, and put all your default settings in there as above.
     
    markowe, Dec 18, 2009 IP
  12. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #12
    just create css file with php and make sure that css set font-family: Arial for body{}

    regards
     
    ghprod, Dec 19, 2009 IP
  13. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Thanks everybody for helping me. This code solved my problem.

    GCS
     
    globalcashsite, Dec 19, 2009 IP
  14. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Hi buddy

    Additionally I added the following to set standard font size of all module and it worked. :D

    body {font-size:12;}
    table {font-size:12;}
    table tr {font-size:12;}
    table tr td{font-size:12;}


    GCS
     
    globalcashsite, Dec 20, 2009 IP