Style for Safari?

You are here:  SillyDog701 > Message Centre > Web Design and Page Coding > [sdt=16085]
SillyDog701 Forums
Author Message
Anonymosity
senior member


Joined: 21 Jun 2008
Posts: 90
22 Oct, 2009 3:49 pm Style for Safari? [sdp=98344]  

I set up a stylesheet to be used to change the colours of page elements in Safari. The background colour changes work, but the text colour does not always override the colour set in the page code. Why is that? I used !important to try to force my colour to override, but that does not seem to work with text.

Is there any way to set a stylesheet to change the colours only if the background is lighter than a certain value? Is there any way to embed javascript code in a stylesheet, to be used with Safari?

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; rv:1.9.1.3) Gecko Firefox/3.5.3
Back to top profile
Antony
Site Admin


Joined: 18 Jun 2002
Posts: 12754
Location: Sydney, Australia
22 Oct, 2009 9:49 pm [sdp=98345]  

Can you show the part of the code that specifies the text colour?

Have you tried something simpler like
Code:
body {color:red}
h1 {color:#125698}
p.test {color:rgb(0,0,255)}


UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3

Back to top profile website
Anonymosity
senior member


Joined: 21 Jun 2008
Posts: 90
22 Oct, 2009 11:42 pm [sdp=98346]  

Yes, I can give you the code that I used to specify the colours.
Code:
body {background-color: #A0FFB0 !important; color: black !important;}
table,td {background-color: peachpuff !important; color: black !important;}
div {background-color: silver !important; color: black !important;}

What does p.test mean in your example?

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; rv:1.9.1.3) Gecko Firefox/3.5.3
Back to top profile
Antony
Site Admin


Joined: 18 Jun 2002
Posts: 12754
Location: Sydney, Australia
23 Oct, 2009 5:01 am [sdp=98349]  

Your code looks fine to me.

Anonymosity wrote:
What does p.test mean in your example?

It means the for the test class under P element.
e.g.
Code:
<p>Hello, this is P.</p>

<p class="test">Hello, this is P.test.</p>


UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3

Back to top profile website
Anonymosity
senior member


Joined: 21 Jun 2008
Posts: 90
23 Oct, 2009 12:35 pm [sdp=98351]  

The problem is that my code does not always override the text colour. For instance, on this page, the background is as I specified, but most of the main body text is white, not black.
http://alum.wpi.edu/~geezer/maiden.html

The text that is normally yellow turns black, but the white text remains white.

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; rv:1.9.1.3) Gecko Firefox/3.5.3
Back to top profile
Antony
Site Admin


Joined: 18 Jun 2002
Posts: 12754
Location: Sydney, Australia
23 Oct, 2009 9:13 pm [sdp=98361]  

The linked page does not have any CSS included.

I am a bit lost what you want to achieve.

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3

Back to top profile website
Anonymosity
senior member


Joined: 21 Jun 2008
Posts: 90
23 Oct, 2009 11:25 pm [sdp=98362]  

That page uses HTML code to set the colours. Does that mean that one cannot use a browser content stylesheet to override text colours if they are set with HTML code?
If the background of that page is normally black, and I change it to light green, but most of the text is white, it is very difficult to read. The reason I am using the stylesheet to change the colours is because white backgrounds bother my eyes. They are too bright. If there were some way to detect whether the brightness of the background is very light and if so, just change the background for that, it would be fine.

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; rv:1.9.1.3) Gecko Firefox/3.5.3
Back to top profile
Antony
Site Admin


Joined: 18 Jun 2002
Posts: 12754
Location: Sydney, Australia
24 Oct, 2009 12:38 am [sdp=98365]  

Anonymosity wrote:
That page uses HTML code to set the colours. Does that mean that one cannot use a browser content stylesheet to override text colours if they are set with HTML code?

Even the page uses HTML to set the colour, the colour (and all other styles) can stilled by specified (changed) by CSS.
So you want to overwrite the style and colour settings originally set by the authour of that page, just on your browser?
OR
You want to change the display of that page or everybody would read it differently?

UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3

Back to top profile website
Anonymosity
senior member


Joined: 21 Jun 2008
Posts: 90
24 Oct, 2009 3:09 pm [sdp=98368]  

Quote:
You want to change the display of that page or everybody would read it differently?

I cannot very well do that, since it is not my page.
I want Safari to display any page with the colours set the way I specify, unless there is a way to get Safari to examine the background and just change it if it is too bright. With Firefox, I have a nice extension that dims the background if it is too bright, but I have not found any such thing for Safari, so I settled for an imported stylesheet instead. I guess I could just make the background colours a bit darker to read both white and black text on them.

UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.1.3) Gecko Firefox/3.5.3
Back to top profile
Display posts from previous:   
Reply to topic    Forum Index > Web Design and Page Coding All times are CST (GMT -6)
page 1 of 1
To add your questions, comments, and for more features and more, please join SillyDog701 Message Centre. It's free! This is SillyDog 701 Message Centre (SD701 Forums).

Apple iTunes iTunes

*Search | FAQ | Rules and Policies | MozInfo701 - Mozilla Information Centre | SD701 Open Directory | Message Board Map | download Netscape