473,803 Members | 4,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Style "fallback"?

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).
--

jeremy
Jul 21 '05 #1
5 2352
Els
Jeremy wrote:
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:Helvetic a,sans-serif;font-size:95%;">
?

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

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #2
In our last episode,
<MP************ ************@ne ws.individual.n et>,
the lovely and talented Jeremy
broadcast on comp.infosystem s.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.

--
Lars Eighner ei*****@io.com http://www.larseighner.com/
Honesty is the best policy, but insanity is a better defense.
Jul 21 '05 #3
In article <1u************ *************** ***@40tude.net> , Els says...
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:Helvetic a,sans-serif;font-size:95%;">
?

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
--

jeremy
Jul 21 '05 #4
Els
Jeremy wrote:
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">
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 :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Skunk Anansie - Charity
Jul 21 '05 #5
In article <1x************ *************** ****@40tude.net >, Els says...
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.

--

jeremy
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
12345
by: Martin Goldman | last post by:
Hello all, I've been struggling for a few days with the question of how to convert "smart" (curly) quotes into straight quotes. I tried playing with the htmlentities() function, but all that is doing is changing the smart quotes into nonsense characters. I also searched the web for quite a while and was unsuccessful in finding a solution. What puzzles me is that doing it the other way around is simple enough. For example, this works...
35
2959
by: les_ander | last post by:
Hi, I know that i can do readline() from a file object. However, how can I read till a specific seperator? for exmple, if my files are name profession id #
6
2739
by: Hostile17 | last post by:
What's considered to be the definitive version of a "good font settings" style sheet? That is, one which allows nearly all modern browsers, and Netscape 4, to get readable text. The basis of this is at http://www.alistapart.com/stories/sizematters/ -- the column "Size Matters" by Todd Fahrner. The concept, as I understand it, is set Netscape 4 fonts to specific
43
42820
by: Dimitri Debruyne | last post by:
Hi group I am in the process of developing a website in XHTML Strict and CSS. Is there a way to open a link in a new window without the use of frames or Javascript or something ? I didn't find a way ... TIA
15
2855
by: Sander Tekelenburg | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The HTML specs speak of "replaced" and "non-replaced" elements, yet for the life of me I can't find an explanation of what "replaced" is supposed to mean in this context. Can someone explain? TIA
2
2144
by: mstearne | last post by:
Has anyone seen any Javascript that mimics the effect that allows you to browse through the New Releases, Just Added sections of the iTunes Music Store? Where you click the arrow icon and the next 4 albums are shown. Example: http://imac2.taxrecords.com/mstearne/misc/Picture3.png Thanks, Michael
7
6495
by: Jan | last post by:
Hi: I was so sure this was easy that I left it for the last minute and now I'm stuck. I'm working on the student directory for my kids' school and since it will be printed on 3-hole punch paper, we need the margins to switch: big left margin on the even-numbered pages, big right margin on the odd-numbered pages. But I can't for the life of me figure out how to set this up, programmatically or otherwise. I searched the archives, etc....
9
2938
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using JavaScript. I have used a readymade javascript and there are variables like...
5
3237
by: Jeremy | last post by:
Hi all, I have database actions that will potentially take several seconds to complete. My normal page uses AJAX so keeping the user informed of what is happening is not a problem. However, the page also has fallback code in case of no Javascript. In this case I would like to display temporary "please wait" type page
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.