•Try•
Catch

MODX Templating Trick

Easily style your MODX Resources

So MODX is awesome right? Yup, it is. So is CSS. You may find it useful to be able to easily alter the styles of your MODX site based off properties of the current page.

<body class="[[*alias]] id-[[*id]] t-[[*template]] p-[[*parent]] ck-[[*class_key]]">
 

You can then go crazy in your CSS.

.my-resource {
/* styles for resource by alias */
}
.ck-Article {
/* styles for MODX article page styles */
}
.p-6 {
/* styles for anything with a parent of 6 */
}
.t-3 {
/* styles for template id 3 */
}
.id-8 {
/* styles for resource 8 */
}
 

Comments (2)

  1. tom:
    Oct 19, 2012 at 11:21 AM

    cool idea, hope i remember it...

  2. sepiariver:
    Oct 19, 2012 at 02:39 PM

    Quick, easy, effective. Nice one!


Add a Comment





Allowed tags: <b><i><br>Comment:


** Clean up your style sheet **

modmore