|
| |
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
CSS Variables - 11/16/2005 9:29:39
I don't know what else to call them, so I'll use the word variables for the moment. I thought I saw one time where you could define, at the start of your sheet, things like: background-color:#FFFFFF; color: #CCCCCC; Then further down in your sheet, when you want to define a color then you could just reference the "variable" defined at the beginning. The purpose would be, by just changing the "variables" defined at the beginning, you could effectively change the whole sheet. Am I having hallucinations or did I really see this somewhere? If so, can someone point me in the right direction? Thanks, Andrew PS. And of course, if I'm not hallucinating, the next question will be, "Can I define the variables in a page and not just on the sheet?"
_____________________________
</Chaos, panic, & disorder - my work here is done.>
|
|
|
|
kopythat
Posts: 2 Joined: 11/16/2005 Status: offline
|
RE: CSS Variables - 11/16/2005 9:59:44
are you meaning as just changing the background of tables, cells (certain areas) or changing the whole style of the page, as in chick here to change the background to blue instead of white, or click here to change all the font colours to red. or are you meaning something else all together? Kopy
|
|
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
RE: CSS Variables - 11/16/2005 10:54:32
Something else alltogether. For instance, in a CSS sheet, I might have "background-color:#FFFFFF;" stated a half-dozen times or more. When I want to change it to #FF0000 then I have to go to each place and change it. I don't want to do that. I just want to change it once, at the top of the CSS sheet. It's kind of like what I would do with ASP. At the start of the page I would set a variable and then I could use that variable as many times as I wanted throughout the page (or site). Can I do a similar thing with CSS? Thanks, Andrew
_____________________________
</Chaos, panic, & disorder - my work here is done.>
|
|
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
RE: CSS Variables - 11/16/2005 12:31:47
quote:
ORIGINAL: bobby You can put your CSS into an "inline" sheet at the top of each .asp page. Then take the whole thing and put it into an include file (so you can still manage it from a single file) and define ASP variables that way... Aaaah, I like that. Of course that begs the question, "Why doesn't everyone do it that way?" It would allow you to make a template and then change it at will by just re-defining the variables. If you have a customer that wants goldenrod instead of gold then BAM! it's done. Andrew
_____________________________
</Chaos, panic, & disorder - my work here is done.>
|
|
|
|
d a v e
Posts: 4071 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: CSS Variables - 11/16/2005 13:26:27
quote:
If you have a customer that wants goldenrod... and who wouldn't want that ;)
_____________________________
David Prescott Gekko web design
|
|
|
|
rdouglass
Posts: 9206 From: Biddeford, ME USA Status: offline
|
RE: CSS Variables - 11/16/2005 19:19:34
I never use style.css anymore. I always use style.asp and here's a typical chunk: ....... body { background-color: <%=themeBody%>; } .myHeaderBackground:link { background-color: <%=themeLinkBackColor%>; border-top: 1px solid <%=themeSeparatorColor%>; border-left: 1px solid <%=themeSeparatorColor%>; border-bottom: 3px solid <%=themeSeparatorColor%>; border-right: 3px solid <%=themeSeparatorColor%>; } .myDarkBackground { background-color: <%=themeDarkBackColor%>; } .myMedBackground { background-color: <%=themeMedBackColor%>; } .myLightBackground { background-color: <%=themeLightBackColor%>; } .myLineColor { background-color: <%=themeSeparatorColor%>; } .myMainTableColor { background-color: <%=themeMainTableColor%>; } ..... Is that what you mean? In fact, one of my Content Management solutions uses this exact thing with a few "themes" in a database with pre-defined color schemes as well as a copy/paste form to build / edit the themes.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
RE: CSS Variables - 11/16/2005 22:49:02
quote:
Is that what you mean? Yes! At least what you have illustrated is what I understood when Bobby suggested...quote:
You can put your CSS into an "inline" sheet at the top of each .asp page. Then take the whole thing and put it into an include file (so you can still manage it from a single file) and define ASP variables that way... And using this in a Content Management solution is exactly my intention. To date, themes (skins) have always included both layout and color scheme. My question was prompted by my desire to just have a few themes (skins) that govern only layout - then have the color schemes defined as we've described here. I'm just coming back (a little bit) from a relatively long break from web work. I thought I recalled that it could be done, but I just couldn't remember how. (brain cramp) This thread got me back on track. Thanks, Andrew
_____________________________
</Chaos, panic, & disorder - my work here is done.>
|
|
|
|
Tailslide
Posts: 6003 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
RE: CSS Variables - 11/17/2005 5:08:32
Another thing you can do is to give each page a specific id so that, if as Womble mentions you give each section of the page a different id too then you can be page specific in your external stylesheet. So you could have: #homepage img {float:right;} or my personal favourite is to give each nav item in the nav menu a different id and then you can refer to it from the CSS stylesheet allowing you to highlight the active nav item etc and then remove all the nav to a seperate include file. so: #homepage #nav-home {color:blue; font-weight:bold;} or whatever. I used to put my stylesheet "calls" into an include but it was a PIA for changing stuff locally because there was no style applied. What I do now is to have a link in head section to a stylesheet which then has a @import link to the actual stylesheet. Same end result as having an include - you can swap and change the stylesheet in the linked-to stylesheet without having to go through every page. The added benefit is that NN4 doesn't like @import so it dumps that out leaving it to see a "plain page"
_____________________________
"My strategy is so simple an idiot could have devised it" Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project
|
|
|
|
drogers
Posts: 142 Joined: 5/7/2004 Status: offline
|
RE: CSS Variables - 1/19/2006 21:31:06
I know this is an older post, but I had a question. How/where do you need to insert an asp based "style" sheet? Would you include it as an inline style sheet or as an embedded style sheet? Do you reference it the same way you would a regular style sheet? How is it for positioning of elements? I know that's a lot of questions, but I have a large, complex piece of web software I'm developing and this kind of on the fly customization is exactly what I need...I think.
|
|
|
|
dpf
Posts: 7121 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: CSS Variables - 1/20/2006 6:57:55
quote:
insert an asp based "style" sheet define asp based style sheet
_____________________________
Dan
|
|
|
|
drogers
Posts: 142 Joined: 5/7/2004 Status: offline
|
RE: CSS Variables - 1/20/2006 9:04:38
From Above: quote:
ORIGINAL: rdouglass I never use style.css anymore. I always use style.asp and here's a typical chunk: ....... body { background-color: <%=themeBody%>; } .myHeaderBackground:link { background-color: <%=themeLinkBackColor%>; border-top: 1px solid <%=themeSeparatorColor%>; border-left: 1px solid <%=themeSeparatorColor%>; border-bottom: 3px solid <%=themeSeparatorColor%>; border-right: 3px solid <%=themeSeparatorColor%>; } .myDarkBackground { background-color: <%=themeDarkBackColor%>; } .myMedBackground { background-color: <%=themeMedBackColor%>; } .myLightBackground { background-color: <%=themeLightBackColor%>; } .myLineColor { background-color: <%=themeSeparatorColor%>; } .myMainTableColor { background-color: <%=themeMainTableColor%>; } ..... Is that what you mean? In fact, one of my Content Management solutions uses this exact thing with a few "themes" in a database with pre-defined color schemes as well as a copy/paste form to build / edit the themes.
|
|
|
|
Galdelonian
Posts: 4 Joined: 1/5/2006 Status: offline
|
RE: CSS Variables - 1/27/2006 20:15:07
The reason I don't usually do that is because some people like odd colors when I'm designing a page or site for them and they like changing the color of different things. Thus no theme, but still it's how they want it, not to mention I hand script everything and doing it all by hand is actually alot easier without that code. Though CSS ain't long, when you try to script alot of it in a row you sorta miss a ; or two and that's just not exceptable. Though I do like the idea. Knew about it before, but never knew how to do it till just now. :D
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|