How can Used php inside CSS ?

Discussion in 'CSS' started by Prog4rammer, Oct 11, 2010.

  1. #1
    Hello ever guys :)

    any one used php inside css code ? How can used This
     
    Prog4rammer, Oct 11, 2010 IP
  2. Brian Angel

    Brian Angel Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    Um ...not sure why you would want to. Since PHP is a server based code and CSS "styles"the HTML on a browser level...what are you tring to accomplish???
     
    Brian Angel, Oct 11, 2010 IP
  3. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #3
    I heard only JavaScript in CSS, perhap you've confused?
     
    temp2, Oct 11, 2010 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You cannot use PHP or Javascript inside a stylesheet, but you can use them to change properties and create new ones.
    You can even switch stylesheets with just one line of PHP code.
     
    Cash Nebula, Oct 11, 2010 IP
  5. Zeh.

    Zeh. Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can.

    You save your stylesheet with .php extension and you can code with <?php and ?> perfectly.
    Also maybe you can use a header('Content-type: text/css');

    Regards.
     
    Zeh., Oct 11, 2010 IP
  6. Keppy

    Keppy Peon

    Messages:
    78
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You cant use PHP code in a CSS file. You must have a .PHP file extension in order for a PHP code to execute properly, However you can create a CSS file with a PHP file extension, with that you can add your PHP code.
     
    Keppy, Oct 11, 2010 IP
  7. jmiles

    jmiles Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If your framework is wordpress you can place the css in the functions.php file and call the function in header.php.
     
    jmiles, Oct 11, 2010 IP