CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 15th, 2003, 11:28 AM
jporven jporven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 6 jporven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question possible? internal reference among css styles

I have been trying to determine the possibility [can it be done?] and method [wehat would the refherence look like?] of defining a color in one part of my css document and having other styles get their color values from that defenition. I'd prefer to do this without using multiple style sheets or nested styles.

An example of what I'd like to do would be the following:

.MainColor{#000000}

.TableBorder{color: .MainColorValueGoesHere}

I'd like to do this so I can set up three or four items similar to .Maincolor [to create a color scheme] and then have all my other styles get their color vales from those three or foeur items. This would allow me to change entire color scheme for my pages by just altering the 3-4 items.

If anyone knows of alternate workarounds or can suggest a different approach, all help is greatly appreciated.

Reply With Quote
  #2  
Old September 15th, 2003, 11:55 AM
f'lar's Avatar
f'lar f'lar is offline
Senior WeyrLeader
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Aug 2003
Location: WI
Posts: 3,782 f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level)f'lar User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 3 Days 22 h 12 m 27 sec
Reputation Power: 675
Send a message via Google Talk to f'lar
I know what you're talking about. On my site I have a rounded border for the main content of each page, and I have it down to where I can change the color of the border by changing one number on the style sheet. It would be nice to be able to name that color something like BorderColor, and then later if I add other, similar features, or if I want to use the same color for other purposes, so be able to reference that definition. It probably can be done, but I don't know how to do it.
__________________
Primary Forums: .Net Development, MS-SQL, C Programming
VB.Net: It's not your father's Visual Basic.

[Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

Reply With Quote
  #3  
Old September 15th, 2003, 12:55 PM
Ucht's Avatar
Ucht Ucht is offline
This is only a test
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Off the air
Posts: 2,893 Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 20 h 1 m 43 sec
Reputation Power: 147
You could create a JS script to write out your stylesheet and set your colors through variables, so you only have to change the variable once...

Reply With Quote
  #4  
Old September 15th, 2003, 01:57 PM
jporven jporven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 6 jporven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
? on js suggestion

Do you mean use JS to "write in" my values like so:

javascript:

function DisplayColor(i)
{
document.write(Color[i])
}

then in my css use:

.MainColor{color: DisplayColor(i);}



[I know the syntax is off, I haven't used js to "write" into a document in a while and need to lookup the syntax]

So, the general idea is to set my color values in a js file/function then call those values within my css stylesheet. Correct?

Reply With Quote
  #5  
Old September 15th, 2003, 02:30 PM
Ucht's Avatar
Ucht Ucht is offline
This is only a test
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Off the air
Posts: 2,893 Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level)Ucht User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 20 h 1 m 43 sec
Reputation Power: 147
Something like that, but you may have to actually document.write the entire stylesheet (or at least the styles you want to be able to use the variable with -- there's no reason not to have a separate non-variabled style sheet); I'm not sure if you'll be able to call a JS function from inside the style itself.

Code:
<script>
  myColor = cc0000

  document.write('<style>'
               + '.style1 {background: ' + myColor + '}'
               + '</style>'
               );
</script>


Not the prettiest way to do it, but it should work.

Reply With Quote
  #6  
Old September 15th, 2003, 02:50 PM
jporven jporven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 6 jporven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks will consider

I'll look over my current structure and see how hard it would be to implement it as js. I didn't want to use two styleshees, but found a very "clean' way of swapping the color schemes at:

http://www.r7designer.com/news/dw_templates/000052.html

Requires changing just one line in your page and the entire "color scheme" is updated. Nice and organized unfortunately I'll have to edit my main .css to remove all references to a second "color" .css.

Still think there must be a way to reference a previous style, it would be a great help since most of my styles share two to three colors.

Reply With Quote
  #7  
Old September 16th, 2003, 01:07 AM
jporven jporven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 6 jporven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still need workaround

How can I set the color value of #999966 once and have my other styles [.masthead_livechattxt , .masthead_slogantxt , and .masthead_telephonetxt] "assume' their color from the initial defenition?

.masthead_livechattxt {
color: #999966;
font: 14px Arial, Helvetica, sans-serif;
text-align: center;
}

.masthead_slogantxt {
color: #999966;
font: bold 18px "Courier New", Courier, mono;
}

.masthead_telephonetxt {
color: #999966;
font: normal 16px Arial, Helvetica, sans-serif;
padding-right: 8px;
text-transform: none;
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > possible? internal reference among css styles


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway