I am writing a stylesheet for a website where I need to support multiple skins / themes. For example, one theme may be black and white with red as the primary color, and another theme may be white on black with maroon as the primary color.
Almost all CSS from one theme moves to another theme, with the exception of things like foreground and background color.
As an illustrative example, let's say we have a div. The size and position of this div is fixed between themes, but the color may change. We could split this into three different CSS files:
#box {
position: absolute;
top: 50px;
left: 50px;
width: 200px;
height: 200px;
}
#box {
backround-color: red;
}
#box {
background-color: maroon
}
main.css . body , CSS. ,
#box {
position: absolute;
top: 50px;
left: 50px;
width: 200px;
height: 200px;
}
body.theme1 #box {
backround-color: red;
}
body.theme2 #box {
background-color: maroon
}
, HTTP . , . , ( ), CSS .
, : CSS, SASS Stylus, CSS?
- :
@theme(theme1) {
$primaryColor: red;
}
@theme(theme2) {
$primaryColor: maroon;
}
position: absolute;
top: 50px;
left: 50px;
width: 200px;
height: 200px;
background-color: $primaryColor;
}
, , CSS, .
? - ?