css - 用于 CSS 继承的 Sass Mixin

标签 css sass inheritance

我刚刚编写了这个 mixin 来帮助解决 IE7 的一些 CSS 继承问题:

=inherit($property)
  $property: inherit

  .ie7 &
    $property: expression(this.parentNode.currentStyle.$property)

编译器没有错误,但我没有从中得到任何输出。

我是这样调用它的:

+inherit(height)

当然,对于所有浏览器,我应该获取 height: inherit 然后在单独的位中为 IE 获取 height: expression(this.parentNode.currentStyle.height)?

有什么想法吗?

最佳答案

我自己解决了:

=inherit($property)
    #{$property}: inherit

    .ie6 &,
    .ie7 &
        #{$property}: expression(this.parentNode.currentStyle.#{$property})

关于css - 用于 CSS 继承的 Sass Mixin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14506580/

相关文章:

css - 与 CSS Zen Garden 类似的事件网站?

node.js - gulp 将任务合并到默认命令中

Mixin、函数和变量名称的 Sass 插值

c++ - C++ 中的泛型 JAVA? <X extends T> 怎么办?

html - 缓慢呈现的 Html 页面

jQuery UI 在滚动 div 中可排序

html - 我如何手动选择换行符,并让 CSS 使包含的 div 足够宽以容纳它们?

sass - Compass @import - 它的基本目录在哪里?

postgresql - PostgreSQL 中的外键 + 表继承?

python - 重复代码与多重继承