开发者

How do you rename CSS rules?

What if you have a CSS template that's really nice, and you want to use it with a wordpress theme, but don't want to edit all the theme files to use the rules in the CSS temp开发者_运维知识库late? Is there a way to create a CSS file that acts as a proxy between the new CSS template and old WP theme?


Good question! I'm afraid I think there is no native way. There would have to be a syntax like

propertyname: inherit-from(.classname);     // Fictitious example! Does not work

which doesn't exist in CSS proper.

It could probably be done, though, using a CSS pre-compiler like LeSS. LeSS's "Mixins" function looks like it might do exactly what you need. From their front page:

.rounded_corners (@radius: 5px) { 
  -moz-border-radius: @radius;
  -webkit-border-radius: @radius;
  border-radius: @radius;
}

#header {  
  .rounded_corners;  
}

where rounded_corners would be your original class definition, and #header the WordPress equivalent.


Child themes! - themeshaper.com/functions-php-wordpress-child-themes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜