By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,723 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,723 IT Pros & Developers. It's quick & easy.

Multiple CSS Style Definitions

P: n/a
Hello,

I would like to define some internal styles within an HTML page, but
have those style overridden by an external style sheet if it exists at
the location specified by a <link> element.

If the external style sheet does not exist, then I would like the
internal styles that are defined in the HEAD section of the HTML page
to be used by default.

I have not been able to find any information on how to setup this type
of internal and external style definition.

Does anyone know how this can be done?

Regards,
Jacob.
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Jacob" <ja******@hotmail.com> wrote in message
news:f9**************************@posting.google.c om...
....
I would like to define some internal styles within an HTML page, but
have those style overridden by an external style sheet if it exists at
the location specified by a <link> element.


Have you tried defining the internal styles
before the <link>?

AFAIU the last styles defined take precedence.

HTH

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #2

P: n/a
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in message news:<Mk******************@news-server.bigpond.net.au>...
"Jacob" <ja******@hotmail.com> wrote in message
news:f9**************************@posting.google.c om...
...
I would like to define some internal styles within an HTML page, but
have those style overridden by an external style sheet if it exists at
the location specified by a <link> element.


Have you tried defining the internal styles
before the <link>?

AFAIU the last styles defined take precedence.

HTH


Hi Andrew,

Yes, I tried putting the <link> both before and after the internal
styles, but when I then viewed the HTML in IE 6.x it was displayed
using the internal styles each time.

(I know it was using the internal styles as I temporarily changed the
color of the text in the internal style so I would know which set of
styles were being applied.)

Any other ideas?

Regards,
Jacob
Jul 20 '05 #3

P: n/a
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in message news:<Mk******************@news-server.bigpond.net.au>...
"Jacob" <ja******@hotmail.com> wrote in message
news:f9**************************@posting.google.c om...
...
I would like to define some internal styles within an HTML page, but
have those style overridden by an external style sheet if it exists at
the location specified by a <link> element.


Have you tried defining the internal styles
before the <link>?

AFAIU the last styles defined take precedence.

HTH


Hi Andrew,

As it turns out I did not have a color explicitly defined in the
external styles, so the temporary color I did have defined in the
internal styles were always taking effect.

After I explicitly defined colors in the external styles, then the
external styles would obviously apply to the HTML page if the <link>
element was placed after the definition of the internal styles.

Thank you for your help.

Regards,
Jacob.
Jul 20 '05 #4

P: n/a
"Jacob" <ja******@hotmail.com> wrote in message
news:f9*************************@posting.google.co m...
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in message news:<Mk******************@news-server.bigpond.net.au>...
"Jacob" <ja******@hotmail.com> wrote in message
news:f9**************************@posting.google.c om...
...
I would like to define some internal styles within an HTML page, but
have those style overridden by an external style sheet if it exists at
the location specified by a <link> element.


Have you tried defining the internal styles
before the <link>?

AFAIU the last styles defined take precedence.

.... Yes, I tried putting the <link> both before and after the internal
styles, but when I then viewed the HTML in IE 6.x it was displayed
using the internal styles each time.

(I know it was using the internal styles as I temporarily changed the
color of the text in the internal style so I would know which set of
styles were being applied.)

Any other ideas?


Sorry, no. I'll have to cede to those more
experienced w/ overriding styles. I'm still a
learner myself (with a great deal more to
learn, by all indications).

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #5

P: n/a
"Jacob" <ja******@hotmail.com> wrote in message
news:f9**************************@posting.google.c om...
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in message news:<MkUFb.62642
.... As it turns out...
:) I thought about it and realised my
understanding of styles must be very
remiss if I got the precedence wrong,
so I thought to check it myself.
http://www.physci.org/test/override/
Thank you for your help.


No worries. Glad you sorted it. ;-)

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.