Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-18-2008, 06:26 PM   PM User | #1
silverchild
New to the CF scene

 
Join Date: Nov 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
silverchild is an unknown quantity at this point
Opacity Technique Question

I'm not sure how to do something in Firefox, or if it even can be done.

What I want is to have a box with a background color, with the opcaity set to 40 or .4. Then, I want to have another div sit on top of that div and display text at 100% or 1 opacity.
The idea is to darken the background image enough so that the text is readable.

I've tried divs, divs within divs, putting the text on the first line or the second line. Nothing seems to work.

I can get it to work in IE but not FF. Can this be done?

Last edited by silverchild; 11-18-2008 at 06:36 PM.. Reason: Added browser details
silverchild is offline   Reply With Quote
Old 11-18-2008, 06:45 PM   PM User | #2
silverchild
New to the CF scene

 
Join Date: Nov 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
silverchild is an unknown quantity at this point
Smile Resolved

I guess you have to set the position of the element with full opcaity using position-relative. Interesting.

I used :
http://www.mandarindesign.com/troops...backgroundhard
silverchild is offline   Reply With Quote
Old 11-18-2008, 06:58 PM   PM User | #3
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
In theory you could use rgba() color co-ordinates, but it's only supported in Firefox 3; not sure about Opera and WebKit. If you're not supporting IE6, PNG alpha would be a good idea.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 11-18-2008, 08:51 PM   PM User | #4
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
Firefox 3 and Safari 3 supports rgba (see css3.info)
For everyone else, I would use a png (with hack for ie6).
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."
eak is offline   Reply With Quote
Reply

Bookmarks

Tags
css, no opacity, opacity

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:07 PM.


Advertisement
Log in to turn off these ads.