Olaf Doschke
Programmer
The following example of inheritance works, but I wonder if this is standard, or I'm just lucky, that IE interprets it as I intended. I display flags for choosing the language of a webpage with this CSS:
The idea is, all flags have the same size, so I define width+height once as id #flag.
Then I subclass this for each language with a picture of the flag (I'll use that style for a div id="flag"), which leads to #flag.english and #flag.german.
A webpage may or may not be available in a language, so I add subclasses .active and .inactive with different filters on the picture to render it active ( with a glow effect) and inactive (dimmed/bleached).
Okay, everythings fine so far.
Now If use this html, it displays the active english flag:
And with this html I display the german flag with a filter effect that renders it dimmed (inactive):
1. Is it standard to specify the subclass german.inactive this way? Do all browsers render that with the right style?
I think filter is also specific to IE, but I may change that if the class name specification works this way.
2. I needed to repeat the definition of active ans inactive style for both languages. I could change the order, eg instead of first defining the english and german flag, I'd define #flag.active and #flag.inactive. But then I would repeat the style for the languages.
Is there a better way to do this, or is that the limitation of class inheritance in CSS?
Bye, Olaf.
Code:
#flag {width:20px; height:12px;}
#flag.english {background-image: url(Pics/Flags/English.gif);}
#flag.english.active {filter: Glow(color=#FFFFFF, strength=3);}
#flag.english.inactive {filter:Alpha(opacity=30, finishopacity=25, style=2);}
#flag.german {background-image: url(Pics/Flags/German.gif);}
#flag.german.active {filter: Glow(color=#FFFFFF, strength=3);}
#flag.german.inactive {filter:Alpha(opacity=30, finishopacity=25, style=2);}
The idea is, all flags have the same size, so I define width+height once as id #flag.
Then I subclass this for each language with a picture of the flag (I'll use that style for a div id="flag"), which leads to #flag.english and #flag.german.
A webpage may or may not be available in a language, so I add subclasses .active and .inactive with different filters on the picture to render it active ( with a glow effect) and inactive (dimmed/bleached).
Okay, everythings fine so far.
Now If use this html, it displays the active english flag:
Code:
<div id="flag" class="english active"></div>
And with this html I display the german flag with a filter effect that renders it dimmed (inactive):
Code:
<div id="flag" class="german inactive"></div>
1. Is it standard to specify the subclass german.inactive this way? Do all browsers render that with the right style?
I think filter is also specific to IE, but I may change that if the class name specification works this way.
2. I needed to repeat the definition of active ans inactive style for both languages. I could change the order, eg instead of first defining the english and german flag, I'd define #flag.active and #flag.inactive. But then I would repeat the style for the languages.
Is there a better way to do this, or is that the limitation of class inheritance in CSS?
Bye, Olaf.