-
Notifications
You must be signed in to change notification settings - Fork 14
Hitch constants
clintjhill edited this page Feb 12, 2012
·
4 revisions
A simple mechanism for you to define your own constants for use in CSS.
@-hitch-const <constant> <what-it-represents>
Hitch Constants are simple text replacements and provide a way to maintain a single instance that is referenced in many places within a stylesheet.
Typical cases would be to maintain a color in one place and reference it by name in many other places. Likewise you can maintain a long selector in one place and reference it by name in many other places.
<style x-hitch-interpret="true">
/* Set the constant -log-blue equal to #336699 in all instances
where it's used in the stylesheet. */
@-hitch-const -logo-blue #336699;
@-hitch-const -logo-gray #333333;
div.logo {
background-color: -logo-blue;
color: -logo-gray;
}
</style>
<style x-hitch-interpret="true">
/* Set the constant -toolbar equal to a long selector that is
referenced many other times in the stylesheet. */
@-hitch-const -toolbar div.tools > .toolbars .main .toolbar
-toolbar {
font: 1em/0.8em Arial sans-serif;
}
div.header -toolbar {
font-size: 0.75em;
}
div.footer -toolbar {
font-size: 0.95em;
}
</style>