|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Selectively overriding CSS
Hi,
Just playing around with user.css (Opera's equivalent to userContent.css); is there any way to override rules to an element based on CSS rules, not attributes? That sounds very confusing, so here's an example of what DOES work: In the page: Code:
<font face="terminal">Stupid bitmap font that renders illegibly with Opera</font> And in my user.css: Code:
*[face="terminal"] {
font-family: lucida console, sans-serif;
};
BUT unfortunately, for once it's a BAD thing that the page designers are adhering to standards: In the page: Code:
* {
font-family: terminal;
}
Is there a way to override this without reading the entire web in Lucida Console? Last edited by Akdor 1154 : January 15th, 2006 at 07:48 PM. Reason: Forgot closing tag; The difference a single comma can make! |
|
#2
|
|||
|
|||
|
|
|
#3
|
|||
|
|||
|
No, the overriding itself isn't the problem, Opera give user style sheets highest priority. It's specifying what needs to be overwritten. If the Terminal font was specified in the attribute, I could use *[face="terminal"] as a selector, but as it's specified in CSS, this doesn't work. Is there a way to achieve the same effect as if it's with an attribute?
|
|
#4
|
|||
|
|||
|
Oh... No. If you wanted to go to the trouble, you might be able to write a JavaScript script to do it.
I suppose you could delete fonts you don't like from your computer and then Opera would pick a different font to display. |
|
#5
|
||||
|
||||
|
I'm intrigued by this idea, and I'll be honest, I don't have an answer.
I think one of the flaws with your example is the fact that most web designers don't use FONT tags anymore. Would an Opera user.css file override something like: Code:
<span style="font-family: terminal">Some words</span>
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
|
#6
|
|||
|
|||
|
Hmm... I wonder if separate CSS <style type="test/css"> rules count under the "style" attribute?
Time for some testing... I never thought I'd be sad to see the <font> tag go... ![]() |
|
#7
|
|||
|
|||
|
Post-testing:
No, in Opera at least the style="" attribute is totally ignored for attribute selecting. Damn. |
|
#8
|
||||
|
||||
|
I'm glad to see the font tag go! It only makes sense... keep presentation teir out of the data. HTML is like plain old data, and it's CSS that makes it pretty. I'm glad the <B>, <U>, <I> tags are on their way out too... =)
But that's a rant deserving of it's own thread. Code:
*[face="terminal"] {
font-family: lucida console, sans-serif;
};
Perhaps the user.css isn't the greatest solution for you. What is it you're ultimately trying to achieve? |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > Selectively overriding CSS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|