Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / June 2005



Tip: Looking for answers? Try searching our database.

Style "fallback"?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeremy - 29 Jun 2005 09:34 GMT
Apologies if the terminology isn't quite right here...

say we have the following code:

<SELECT NAME="p1_val" class=list-element>

If the class "list-element" isn't defined, is it possible to specify an
alternative class that is to be used? (Rather like the <font face=...>
tag where you can specify preferred fonts fisrt if installed on the
client machine).

Signature

jeremy

Els - 29 Jun 2005 10:02 GMT
> Apologies if the terminology isn't quite right here...
>
> say we have the following code:
>
> <SELECT NAME="p1_val" class=list-element>

class="list-element" (with quotes)

> If the class "list-element" isn't defined, is it possible to specify an
> alternative class that is to be used? (Rather like the <font face=...>
> tag where you can specify preferred fonts fisrt if installed on the
> client machine).

I'm not sure what it is you want.
You want to have
<select name="p1_val">
instead of
<SELECT NAME="p1_val" class="list-element">
?

Or are you after inline styles:
<SELECT NAME="p1_val"
style="font-family:Helvetica,sans-serif;font-size:95%;">
?

Any reason you don't want to specify the styles for the class as usual
in CSS?

Signature

Els                     http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
                            - Renato Russo -

Jeremy - 29 Jun 2005 10:14 GMT
> I'm not sure what it is you want.
> You want to have
[quoted text clipped - 10 lines]
> Any reason you don't want to specify the styles for the class as usual
> in CSS?

Sorry I wasn't clear.

Assume in the style sheet we may have

<style>
.list-element {various attributes}
.list-element-2 {various other attributes}
</style>

Then within the HTML generated:

<SELECT NAME="p1_val" class="list-element-2">

If the class list-element-2 isn't defined in the style sheet, would like
it to default to list-element (which we know will always be defined).

So in "nonsense code" (using the structure of the <font face=f1,f2,f3
etc> ):

<SELECT NAME="p1_val" class="list-element-2,list-element">

It's a database app, like to give the users the opportunity to update
their style sheets (held outside of the app) to specify attributes for
the new class, but if not yet defined, fallback to the one which we know
is defined.... not ideal but if it is possible it woul dbe useful.

cheers

Signature

jeremy

Els - 29 Jun 2005 10:23 GMT
> Assume in the style sheet we may have
>
[quoted text clipped - 14 lines]
>
> <SELECT NAME="p1_val" class="list-element-2,list-element">

almost:
<SELECT NAME="p1_val" class="list-element-2 list-element">

The order of the two class names doesn't matter btw. Both styles will
be applied, and in case of any collision, the style that is later in
the stylesheet will prevail.

Alternatively, you can just set the 'fallback styles' for 'select'.
(assuming it's okay to apply those styles to all <select> elements on
the page)

> It's a database app, like to give the users the opportunity to update
> their style sheets (held outside of the app) to specify attributes for
> the new class, but if not yet defined, fallback to the one which we know
> is defined.... not ideal but if it is possible it woul dbe useful.

Sounds like two classes would do the job, as long as the client
understands that they should write styles specifically to overrule the
default ones if needed :-)

Signature

Els                     http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
                            - Renato Russo -
Now playing: Skunk Anansie - Charity

Jeremy - 29 Jun 2005 10:24 GMT
> almost:
> <SELECT NAME="p1_val" class="list-element-2 list-element">
>
> The order of the two class names doesn't matter btw. Both styles will
> be applied, and in case of any collision, the style that is later in
> the stylesheet will prevail.

Sounds perfect - many thanks for your help.

Signature

jeremy

Lars Eighner - 29 Jun 2005 10:09 GMT
In our last episode,
<MPG.1d2c6d7da47eee05989ec3@news.individual.net>,
the lovely and talented Jeremy
broadcast on comp.infosystems.www.authoring.stylesheets:

> Apologies if the terminology isn't quite right here...

> say we have the following code:

><SELECT NAME="p1_val" class=list-element>

> If the class "list-element" isn't defined, is it possible to specify an
> alternative class that is to be used? (Rather like the <font face=...>
> tag where you can specify preferred fonts fisrt if installed on the
> client machine).

I doubt know how to do that as a class.  You can establish
default styles with the SELECT element (in this case).  That's
what the "C" in CSS is all about.  If you start styling with
classes, you are just asking for more work and the possibility
of a circus broadside appearance overall.  I think you will find
it much easier to begin with the top level element and work
down.  Use class and id for stuff that just has to be different
from the context for some reason.

Signature

Lars Eighner              eighner@io.com           http://www.larseighner.com/
        Honesty is the best policy, but insanity is a better defense.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.