Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#208038 - 03/03/2004 15:52 CCS Inheritance?
foxtrot_xray
addict

Registered: 03/03/2002
Posts: 687
Loc: Atlanta, Georgia
I probably spelt that wrong. Sue me.

Anyways, if I specify two style-sheets in HTML, what's the standard? i.e. If I have:
<link rel="stylesheet" href="fixedsheet.ccs">
<link rel="stylesheet" href="userssheet.ccs">

And in the first have:
.lay_subtitle {font-family: Verdana; font-size: 18pt; color: #000000; border-bottom-style: inset; border-bottom-width: 2px; margin-right: 5px}

And in the second, have:
.lay_subtitle {border-bottom-style: raised}

Would the final style for the "lay_subtitle" be in the Verdana font, 18pt, with a RAISED bottom? Or would the bottom be still "INSET", or would the two cancel each other out and have NO style?

Thanks!
Me.
_________________________
Mike 'Fox' Morrey 128BPM@124MPH. Love it! 2002 BRG Mini Cooper

Top
#208039 - 03/03/2004 16:05 Re: CCS Inheritance? [Re: foxtrot_xray]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
All I know is that everything else in the first style would apply (I'm pretty sure I know this). The problem would come to the border-bottom-style part. I'm not sure what would happen there. You best bet is to try it out and see what happens. Try it in a few browsers too to see if they handle it differently.

And yeah, it's CSS for Cascading Style Sheets
_________________________
Matt

Top
#208040 - 03/03/2004 16:09 Re: CCS Inheritance? [Re: foxtrot_xray]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
Got more for you! Here it is:

First, how things are prioritized:
------------------------------
Multiple Styles Will Cascade Into One

Style Sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the <head> element of an HTML page, or in an external CSS file. Even multiple external Style Sheets can be referenced inside a single HTML document.

Cascading Order
What style will be used when there is more than one style specified for an HTML element?

Generally speaking we can say that all the styles will "cascade" into a new "virtual" Style Sheet by the following rules, where number four has the highest priority:

Browser default
External Style Sheet
Internal Style Sheet (inside the <head> tag)
Inline Style (inside HTML element)

So, an inline style (inside an HTML element) has the highest priority, which means that it will override every style declared inside the <head> tag, in an external style sheet, and in a browser (a default value).
----------------------------------

Now, how multiple external sheets will work (it's pretty interesting, actually):
----------------------------------
Multiple Style Sheets

If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet.

For example, an external style sheet has these properties for the h3 selector:

h3
{
color: red;
text-align: left;
font-size: 8pt
}

And an internal style sheet has these properties for the h3 selector:

h3
{
text-align: right;
font-size: 20pt
}

If the page with the internal style sheet also links to the external style sheet the properties for h3 will be:

color: red;
text-align: right;
font-size: 20pt

The color is inherited from the external style sheet and the text-alignment and the font-size is replaced by the internal style sheet.

*edit*
Hmmm...just read that over and the example they gave for that second one doesn't really match what they say.

Based on the explanation they give (the stuff about "more specific"), I take that to mean one of two things. Either this:

.lay_subtitle {font-family: Verdana; font-size: 18pt; color: #000000; border-bottom-style: inset; border-bottom-width: 2px; margin-right: 5px}

will have priority over this:

.lay_subtitle {border-bottom-style: raised}

because the first is more specific about the class you're talking about, or they mean that something like this:

border: 4px solid green;

will have priority over this:

border: solid red;

I can't be sure though. Sorry for posting a pretty confusing explanation. I guess I didn't read it through carefully enough.


Edited by DiGNAN17 (03/03/2004 16:25)
_________________________
Matt

Top
#208041 - 03/03/2004 16:52 Re: CCS Inheritance? [Re: Dignan]
foxtrot_xray
addict

Registered: 03/03/2002
Posts: 687
Loc: Atlanta, Georgia

And yeah, it's CSS for Cascading Style Sheets

ROFL. I missed that. Jeez. One of those days..

Thanks for the info! I'm actually testing now, just for curiosity's sake.

Me.
_________________________
Mike 'Fox' Morrey 128BPM@124MPH. Love it! 2002 BRG Mini Cooper

Top
#208042 - 03/03/2004 23:07 Re: CCS Inheritance? [Re: foxtrot_xray]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
That's the only thing I can suggest to do. I looked around for quite a while, actually, and there is very little to say about this, though several sites acknowledged that this can happen when there are multiple external or internal style sheets (two of the same, of course). And what was confusing was I saw different info about it. Some seemed to imply that the first referenced style sheet had priority, but most said "the more specific" one, whatever they mean by that.

There was also talk about a "preferred" style sheet, but that's a case of one sheet or the other, I think, as in when a user can choose how your site is displayed.

Good luck
_________________________
Matt

Top
#208043 - 05/03/2004 09:56 Re: CCS Inheritance? [Re: foxtrot_xray]
DLF
addict

Registered: 24/07/2003
Posts: 500
Loc: Colorado, N.A.
I probably spelt that wrong. Sue me.
Careful what you wish for; I'm working on a product called Converged Communications Server.
_________________________
-- DLF

Top
#208044 - 05/03/2004 12:36 Re: CCS Inheritance? [Re: DLF]
foxtrot_xray
addict

Registered: 03/03/2002
Posts: 687
Loc: Atlanta, Georgia
Heh! I can see potential customer e-mails now:

Does your CCS support CSS in HTML and XML?

Scary.

Me.
_________________________
Mike 'Fox' Morrey 128BPM@124MPH. Love it! 2002 BRG Mini Cooper

Top