PHP Variables in the CSS Stylesheet

后端 未结 3 1224
心在旅途
心在旅途 2021-01-28 12:40

I am looking to introduce PHP variables to stylesheets (ie. CSS).

I have worked out that I can print a PHP page as a stylesheet by declaring:

header(\'Co         


        
3条回答
  •  孤城傲影
    2021-01-28 12:43

    You do this the same way you would with HTML:

    
    body {
        border-radius: 3px
    }
    

    But, I don't think this is necessary for your use case. It's actually not uncommon to just statically include all the various -*- options in a css file:

    body {
        -moz-border-radius: 3px;
        border-radius: 3px;
    }
    

    Just add all effective options, and the browser will determine which are most effective for it. This also means you get to avoid the dull and error prone task of browser sniffing.

提交回复
热议问题