Tutorial :How do you rename CSS rules?



Question:

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 template? Is there a way to create a CSS file that acts as a proxy between the new CSS template and old WP theme?


Solution:1

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.


Solution:2

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »