PHP Variables in the CSS Stylesheet

后端 未结 3 1250
心在旅途
心在旅途 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-28 13:02

    SASS CSS extension would allow you to use variables without actually needing to use PHP and the downsides that come with it. Mixins would simplify the generation of vendor-specific style rules.

    @mixin vendor-prefix($name, $argument) {
      -webkit-#{$name}: #{$argument};
      -ms-#{$name}: #{$argument};
      -moz-#{$name}: #{$argument};
      -o-#{$name}: #{$argument};
      #{$name}: #{$argument};
    }
    p {
      @include vendor-prefix(hyphens, auto)
    }
    

提交回复
热议问题