[Pmwiki-users] PmWiki skinning

Val Sharp val
Mon Nov 8 17:55:45 CST 2004


Patrick R. Michaud, on 08.11.04 19:08, wrote:

> On Sat, Nov 06, 2004 at 12:41:02AM +0000, Val Sharp wrote:
> 
>>The CSS cascade order means that rules embedded with a STYLE element 
>>will override any LINKed or imported rules. 
> 
> False ...
 > The precedent for rules in <style> vs. <link> depends on the order
> in which they are declared--the one declared later gets higher 
> priority ...

The world is not as I thought it was!  :-\

I can find nothing in HTML4.01, CSS1 / 2 / 2.1 / 3 to contradict what 
you say, though every website I see on how to write stylesheets says 
that embedded stylesheets take precedence over external 
stylesheets[1]. It never occurred to me to question this widely held 
belief, but I'm obviously wrong here.

>  See http://www.pmichaud.com/sandbox/css-test-1.html 
> for an example/proof.

I'd never take what a browser actually does as proof of what it should 
do   :-)

> What this means in the context of PmWiki templates is that
> externally <link>'ed stylesheets placed after the
> <!--HeaderText--> in the template can override PmWiki's
> default settings without having to use "!important".

Suddenly life becomes so much easier.


[1]  "WATCH OUT: If a style in a linked style sheet conflicts with an 
embedded one, the embedded one takes precedence. Inline styles take 
precedence over both embedded and linked styles: it's what puts the 
'cascade' into Cascading Style Sheets. 
"<http://www.rockpub.com/wttlayout/css_tutorial.html>

      "Rules at the end of the style sheet take precedence over those 
at the start. Inline style is assumed to be read after embedded style, 
which is read after linked style. Imported style sheets form the start 
of the importer's style sheet." 
<http://www.richinstyle.com/guides/concepts2.html#conflict>

      "The "cascading" refers to the hierarchy of control:
- Inline styles takes precedence
- Then Embedded styles rules follow
- The Linked external style sheet instructions will be used if In line 
or Embedded instructions are not present present." 
<http://www.tamingthebeast.net/articles4/css-tutorial.htm>

      "If the same style is defined with different  values in the 
different style sheets then the order of precedence is
-Inline Style Sheets
-Internal Style Sheets
-The last External Style sheet moving in order to the first External 
Style Sheet linked in the head section," 
<http://www.tutorials4u.com/html/tutorial-12-css.htm>

      "Embedded styles take precedence over external styles ... 
External styles have the lowest priority and are superceded by styles 
defined in other ways. " 
<http://www.spoono.com/csst/tutorials/tutorial.php?id=1>

etc, etc, etc

Just goes to show that many people believing something still doesn't 
make it true.


-- 
Best regards,
Val



More information about the pmwiki-users mailing list