This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > September 2005 > Include a style from another class





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Include a style from another class
StarQuake

2005-09-20, 4:24 am

For example:

I have two css files. One with the class foo and one with the class bar:

foo.css:
---------
..foo {
font-size : 12px;
}

bar.css:
---------
..bar {
some include function here
}

What I want is that the class bar becomes exactly the same as foo.

Thanks!

StarQuake

--
for some how-to's and rpms visit my site : http://solid.bounceme.net
for commercially supported solutions visit : http://www.robas.com
'sNiek

2005-09-20, 7:26 am

StarQuake schreef:
> For example:
>
> I have two css files. One with the class foo and one with the class bar:
>
> foo.css:
> ---------
> .foo {
> font-size : 12px;
> }
>
> bar.css:
> ---------
> .bar {
> some include function here
> }
>
> What I want is that the class bar becomes exactly the same as foo.
>
> Thanks!
>
> StarQuake
>


Just call it .foo and the styles it will overrule (or supplement) the styles in the foo.css


--
Niek
StarQuake

2005-09-20, 7:26 am

'sNiek wrote:
> StarQuake schreef:
>
>
> Just call it .foo and the styles it will overrule (or supplement) the
> styles in the foo.css
>
>


Yes, that would be possible but the problem is I can't change the code
that refers to both foo.css and bar.css

So I'd rather do something like this:

..bar {
include .foo
}

If there's no solution I can just copy the contents of the foo class to
the bar class but then everytime I change foo I will have to change bar too.

StarQuake
--
for some how-to's and rpms visit my site : http://solid.bounceme.net
for commercially supported solutions visit : http://www.robas.com
'sNiek

2005-09-20, 7:26 am

StarQuake schreef:
> 'sNiek wrote:
>
>
> Yes, that would be possible but the problem is I can't change the code
> that refers to both foo.css and bar.css
>
> So I'd rather do something like this:
>
> .bar {
> include .foo
> }
>
> If there's no solution I can just copy the contents of the foo class to
> the bar class but then everytime I change foo I will have to change bar
> too.
>
> StarQuake


Another solution would be something like <p class="foo bar">


--
Niek
Stan Brown

2005-09-20, 7:39 pm

On Tue, 20 Sep 2005 10:56:08 +0200 in
comp.infosystems.www.authoring.stylesheets, StarQuake favored us
with...
> So I'd rather do something like this:
>
> .bar {
> include .foo
> }
>
> If there's no solution I can just copy the contents of the foo class to
> the bar class but then everytime I change foo I will have to change bar too.


This is an FAQ; the answer is "no way in CSS, but you can always
implement some sort of text preprocessing to build your CSS file."

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:

http://diveintomark.org/archives/20...e_wont_help_you
Jef Driesen

2005-09-20, 7:39 pm

StarQuake wrote:
> For example:
>
> I have two css files. One with the class foo and one with the class bar:
>
> foo.css:
> ---------
> .foo {
> font-size : 12px;
> }
>
> bar.css:
> ---------
> .bar {
> some include function here
> }
>
> What I want is that the class bar becomes exactly the same as foo.


If you used only one css file you could do something like this:

..foo, .bar {
// Common properties
}
..foo {
// Different properties (foo only)
}
..bar {
// Different properties (bar only)
}
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews