CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 15th, 2002, 09:51 AM
jcallet99 jcallet99 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 2 jcallet99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 14 sec
Reputation Power: 0
Css

I have an external stylesheet that give the following properties to the H3 tag

H3 { font-family:Lucida;
font-style:normal; color:blue }

Later, the publisher adds a font color tag set to RED inside of the H3 tag within their HTML code. Because of the proximity to the affected content the publisher set H3 color of RED will automatically overwrite what is in the external stylesheet. Will this always be the case? Is there anything that I can do to keep this from happening? Is this a case of browser version?

Reply With Quote
  #2  
Old January 15th, 2002, 10:22 AM
binky's Avatar
binky binky is offline
Gerbil
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2001
Location: In a Rotastak
Posts: 1,763 binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 22 h 12 m 52 sec
Reputation Power: 18
It's not really designed that way. Imagine somebody looking at the code who doesn't know anything about the process that created it. They will assume you're wanting to override the CSS for this special circumstance. So, obviously, the CSS rendering engine looks at it in this way.

I know that you can use the ! important notation to override other style sheets applying to a document, but I don't think it extends to hard coded HTML.

Reply With Quote
  #3  
Old January 15th, 2002, 11:43 AM
mrrichardfeder mrrichardfeder is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 765 mrrichardfeder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 45 sec
Reputation Power: 7
In the CSS weighting scheme (the Cascade) inline HTML pretty much rules the roost, as its proximity to the element is taken to indicate - well - a strong desire to style the element that way. CSS doesn't know from pushy publishers. No weighting tricks I'm aware of will override this; you could simply client-side script over the publisher's preferences:

function destroyAllFontTags() {
if (document.getElementsByTagName) {
var fontTags = document.getElementsByTagName('font');
for (var i=0; i<fontTags.length; ++i) {
fontTags[i].setAttribute('color','');
fontTags[i].setAttribute('face','');
fontTags[i].setAttribute('size','');
}
}
}

window.onload = destroyAllFontTags;

Reply With Quote
  #4  
Old January 16th, 2002, 01:43 AM
christeen christeen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: sydney, australia
Posts: 68 christeen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 53 m 50 sec
Reputation Power: 8
to my knowledge there is no way of overriding a font tag in this context

the best suggestion is to strip the font tags as suggested before

for reference though:

to give maximum weight to a style from an external stylesheet use:

<h3 id="myheading">text</h3>

#myheading { font-family:Lucida !important;
font-style:normal !important;
color:blue !important;}

id's have a greater weight than classes which in turn have more importance than selectors (in this case the selector is H3)

!important adds extra weight to your style again

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Css


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway