aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Why Do I Fail to Change the Color of Text Using .css? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Why Do I Fail to Change the Color of Text Using .css?" Watch "Why Do I Fail to Change the Color of Text Using .css?" New topic
Author

Why Do I Fail to Change the Color of Text Using .css?

Daniel Gee
Ranch Hand

Joined: Aug 29, 2003
Posts: 202
I tried to use style sheet to change the color of text; but the color does not change. In my style sheet, I have

.dataContent
{
font-family: Verdana, Arial, Helvetica, Sans-Serif;
font-size:8pt;
color: #FFFFFF
}

Because the background is dark, the text should show when I set the color to white. But, the color of the text is still dark.

What could go wrong?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Dunno. Maybe the browser's being picky about the missing semi-colon? The one's I tested didn't care.

Are you applying the style class where you think you are?

Are there other style rules that could be over-riding the color?
[ March 07, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Originally posted by Daniel Gee:
I tried to use style sheet to change the color of text; but the color does not change. In my style sheet, I have

.dataContent
{
font-family: Verdana, Arial, Helvetica, Sans-Serif;
font-size:8pt;
color: #FFFFFF
}

Because the background is dark, the text should show when I set the color to white. But, the color of the text is still dark.

What could go wrong?



this is only a suggestion. cannot guarantee if it will work
try to use this:



in your span or textbox or whatever put the id="dataContent"

maybe bear is right about your browser


jherald
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Changing a class to an id would just be a band-aid solution. Better to find out why it isn't working as it's liable to be a recurring problem caused by whatever the root problem is.
Daniel Gee
Ranch Hand

Joined: Aug 29, 2003
Posts: 202
OKay, it worked after I re-boot the computer. Something was cached there and could not get rid of it. Thanks for your attention.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why Do I Fail to Change the Color of Text Using .css?