473,699 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to override all sytles?

If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect? It would need to
override DIVs, tables, SPANs, anywhere inline styles are defined,
override external style sheet references, definitions in the HEAD
section.

I won't know ahead of time what exactly the webpage content is.

Thanks,
Brett

Jul 21 '05 #1
11 16724
brett wrote:
If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect? It would need to
override DIVs, tables, SPANs, anywhere inline styles are defined,
override external style sheet references, definitions in the HEAD
section.

I won't know ahead of time what exactly the webpage content is.


Why are you using styles that color text anything *other* than gray if
you want all your text to be gray?
Jul 21 '05 #2
"brett" <ac*****@cygen. com> wrote:
If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect?


Unless I'm missing something,
* { color: gray !important; background: white !important; }
in a user style sheet should do that, and does that, on modern browsers.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 21 '05 #3
in comp.infosystem s.www.authoring.stylesheets, brett wrote:
If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect? It would need to
override DIVs, tables, SPANs, anywhere inline styles are defined,
override external style sheet references, definitions in the HEAD
section.

I won't know ahead of time what exactly the webpage content is.


* {color:#999 !important} in you userstylesheet, if you don't have
conflicting userstyles.
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #4
Yeah, that works well, except with conflicting style sheets. I need to
some how override them. Look at this example and note the table cell
style retains its style. How can I override it?

<html>
<head>
<title>Untitled </title>
</head>

<body style="color: gray !important">

<div id="sample1" style="width:10 0%"><h3>John slowly faded into
view---</h3>
</div>

<a href="x">Here is a problem link</a><br>
<!--style="filter:a lpha(opacity=10 0)"
crossobj.style. MozOpacity-->
<img src="http://www.google.com/images/logo.gif" alt=""
name="imgsample 1" id="imgsample1 " border="0"
style="filter:a lpha(opacity=10 0); -moz-opacity:1"><br>
<div id="sample2" style="width:10 0%"><h3>Anoth er fade occurs
here.</h3></div>
<br>
<a href="x">Here is another problem link</a>
<br><br>

<table><tr><t d style="color: red">this will stay red</td></tr></table>
<div>text in div tag<h4>this is in DIV tag in H4</h4></div>

</body>
</html>
Thanks,
Brett

Jul 21 '05 #5
"brett" <ac*****@cygen. com> wrote:
Yeah, that works well,
"That"? Please quote or paraphrase the relevant part of the message you are
commenting on.
except with conflicting style sheets.
No, what I responded is correct: using !important in a user style sheet
makes the declaration win other style sheets (excluding, of course, other
!important declarations in a user style sheet).
I need to some how override them.
In a user style sheet, you can override them, as I explained. In an author
style sheet, you cannot, by design, and that's _good_.
Look at this example and note the table cell
style retains its style. How can I override it?
Within an author style sheet, if that's what you mean, as you seem to be
meaning, you can override other declarations (assuming they don't use
!important) by using
* { color: gray !important; background: white !important; }
just as I wrote. Did you actually read the message of mine that you are
responding to?
<body style="color: gray !important">


That's something completely different. It only sets the color of the body
element - and unwisely leaves the background unspecified, at the risk of
getting gray on gray.

Of course, setting everything to gray is most probably absurd.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 21 '05 #6
in comp.infosystem s.www.authoring.stylesheets, brett wrote:

What are you replying? Do not top post. Assuming that you still speak
about userstylesheet.
Yeah, that works well, except with conflicting style sheets. I need to
some how override them.
Very hard. But they unlikely have id selectors.
html > head:first-child + body, html > head:first-child + body *
{color:gray !important;}

Gets you specifity 0, 0, 1, 3 works on some browsers.
Look at this example and note the table cell
style retains its style. How can I override it?


URL? If you just added style="color:gr ay !important;" in your file, you
got everything wrong. Maybe you could explain your real problem? With
URL.
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #7
brett wrote:
If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect? It would need to
override DIVs, tables, SPANs, anywhere inline styles are defined,
override external style sheet references, definitions in the HEAD
section.


Not with CSS alone. You can't write a selector more specific then an inline
style attribute.

You could do something like:

my el = document.getEle mentsByTagName( '*');
for (var i = 0; i < el.length; i++) {
el[i].style.color = "rgb(50%,50%,50 %)"
}

It wouldn't be very quick though.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #8
brett wrote:

If I want all text, no matter where it is, to be gray, is there a way
to override styles and have that color take affect? It would need to
override DIVs, tables, SPANs, anywhere inline styles are defined,
override external style sheet references, definitions in the HEAD
section.

I won't know ahead of time what exactly the webpage content is.


If you are a user viewing someone else's Web page, just set your
browser to use only your own colors and to ignore the colors
specified on the page.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Jul 21 '05 #9
Lauri Raittila wrote:
in comp.infosystem s.www.authoring.stylesheets, brett wrote:

What are you replying? Do not top post. Assuming that you still speak about userstylesheet.
Yeah, that works well, except with conflicting style sheets. I need to some how override them.
Very hard. But they unlikely have id selectors.
html > head:first-child + body, html > head:first-child + body *
{color:gray !important;}

Gets you specifity 0, 0, 1, 3 works on some browsers.
Look at this example and note the table cell
style retains its style. How can I override it?


URL? If you just added style="color:gr ay !important;" in your file,

you got everything wrong. Maybe you could explain your real problem? With URL.


Perhaps this isn't the right place to ask this question, but this topic
almost answers a similar question I have--but not quite, unless I am
not understanding the posts completely.

I have a portions of a page that I don't have any easy control over
with content that has inline styles such as this

<p><font color="red">Ret urn-pbath</font></b>:
&lt;1zYzTINizED qr3HXfqno0yqZP6 kJsHlFe@<b><fon t
color="black">1 09326.<b><font color="red">rep ly.<b><font
color="red">sav eyourwallet<b>< font color="blue">.c om</p>

I would like to wrap this in a div element, and create a button that
will toggle everything within that color to have an alternate color
(e.g. black). I have been able to affect the font size and font face
because those aren't specified inline, but the color has so far alluded
me.

Regards,

Michael

Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3147
by: Woodmon | last post by:
Example of my CSS follows: <style type="text/css" media="screen"> BODY { color: white } A:link { color: 66CCFF; } A:visited { color: CC66FF; } A:active { color: CC66FF; } A:hover { color: white; background-color: #0099cc; text-decoration: #000000;}
7
6443
by: Dave Y | last post by:
I am a newbie to C# and am having trouble trying to override a ListView property method. I have created a new class derived from the Forms.Listview and I cannot figure out the syntax to override ListView.Items.Add(), . I see that it is a virtual method so it should be easy to do. If anyone can help I would appreciate it greatly. I can do what I need to do in a different way this would just make everything significantly cleaner and eaasier...
5
2610
by: Mark Broadbent | last post by:
Oh yes its that chestnut again! Ive gone over the following (http://www.yoda.arachsys.com/csharp/faq/ -thanks Jon!) again regarding this subject and performed a few of my own tests. I have two classes yClass which inherits xClass. xClass has a virtual method which simply writes a line of text stating its origin, yClass implements the same method which writes a line of text stating its origin also (i.e. "From yClass"). I ran the...
2
4541
by: Flip | last post by:
In java, the default for methods is override. In c# that is not the case. This talks about two classes, the base class and the overriding class. What happens when you have a third class in the mix, extending the second class, how can you indicate the method in the third class is overridding the overridden method? Do you declare the second method to be virtual override? ClassA ------------- virtual DrawWindow(){//code} ^
5
9594
by: Stoyan | last post by:
Hi All, I don't understand very well this part of MSDN: "Derived classes that override GetHashCode must also override Equals to guarantee that two objects considered equal have the same hash code; otherwise, Hashtable might not work correctly." Does any one know, why we must also override Equals, Please give my an example:) Thanks, Stoyan
15
2546
by: John Salerno | last post by:
Hi all. I have a question about virtual and override methods. Please forgive the elementary nature! First off, let me quote Programming in the Key of C#: "Any virtual method overridden with 'override' remains a virtual method for further descendent classes." Now here's my question: Let's say you have base class A, and subclasses B and C. Class A contains a virtual method, and B contains an override method. If C didn't have an...
2
4053
by: Adriano Coser | last post by:
Hello. After I converted my .net code to the new VC2005 syntax I started to get C4490 on my ExpandableObjectConverter subclass overrides. The GetProperties method is no longer called by the PropertyGrid when I use my subclass as a type converter. Can anyone tell me what has changed? What's the correct way to override GetProperties method? Here's the code for my class:
8
5484
by: bdeviled | last post by:
I am deploying to a web environment that uses load balancing and to insure that sessions persist across servers, the environment uses SQL to manage sessions. The machine.config file determines how all applications will use sessions and to insure that all application use this method, the session properties cannot be overriden. Within the sessionstate tags, the webadmin (upon my request)r emoved the property for timeout, hoping that...
5
4531
by: Marcel Hug | last post by:
Hi NG ! I'm new in C# and I'm reading a book about the fundamentals and concepts. In the chapter Methods it's written to use virtual, if i would like to override the method in a subclass. This I've to do by using override. It's also written, that's possible to "hide" the base class method by using the new key word. Because I've already written some C# code and I didn't know anything
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.