Forum Moderators: not2easy
Something along the lines of: -
.foo {bar}
Where bar has been defined earlier?
I’m attempting to maximise the presentational control in my master external style sheet in a php environment where the class of some of the data from includes might be different dependent on the page that is calling it.
foo and bar would both be defined in the external CSS and, when necessary, the foo style would be replaced by the bar style in the header of the calling page.
Clearly I can achieve this by redefining foo in every page it is necessary but that removes control from the master CSS file.
There is probably an easier way of doing this that I’m missing!
Thanks
<p class="foo">Hello</p>
Which has one style but then
<p class="foo boo">Hello</p>
Which would override the first style.
Equally you could go ID + class on one element but it sounds like you'd be wanting to repeat the styles across the page so this method would be better.
It’s a relatively simple business website with 14 major product groups but most of the website is structured around over 20 market sectors.
Each market sector page has a list of these product groups at the bottom with links and this is simply achieved by a php include.
However in many markets one or two products are not relevant and this presentation has caused some confusion that we want to resolve by de-emphasising the presentation of the irrelevant product in the list.
At the moment the style associated with the list is called “prodlist” I though a simple solution could be to create 14 identical styles “prodlist1 prodlist2 .... prodlist14” plus “prodlistdemph”.
Then, on those pages where, say, product group 7 needs to be de-emphasised to redefine “prodlist7” by making it equal to “prodlistdemph” in the head of the page.
I just don’t know how to define a style by reference to another.
Of course, I can achieve the same effect by hard coding the redefinition in all the appropriate pages and not using "prodlistdemph" but that structure creates work for changes and we are continually tweaking the presentation.
My idea had caused me to ignore it as, with over 20 market sector pages with a couple of de-emphasised on each meant over 50 definitions, but of course, it is really only one definition of a list of 50 elements.
I guess that creating elegant designs based on nonexistent functionality is a good way to waste everyone’s time!