+ Reply to Thread
Page 1 of 5
1 2 3 ... LastLast
Results 1 to 10 of 49

Thread: Text in a transparent div

  1. #1
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508

    Text in a transparent div

    How would you override the transparency setting of a parent div?

    I have a paragraph tag inside a div. The text and the background of the div are the same color, lets say white. The opacity of the div is set to 60%, how do I keep the text at 100%? By default, whatever child element is in that [60%] div, will automatically be at 60% opacity. I can drop the opacity of the text even further, but if I set it to 100%, that is actually 60% because it is inside the div that is set to 60%. Any ideas? Thanks.

    Example:

    HTML Code:
    <div class="transparent">
        <p>This text need to be at 100% transparency, full color.</p>
    </div>
    Code:
    div.transparency {
    background-color:#fff;
    width:150px;
    height:350px;
    opacity:0.6;
    filter:alpha(opacity=60);
    margin:0;
    padding:10px;
    }
    div.transparency p {
    font:normal 10pt Arial;
    color:#fff;
    margin:0;
    padding:0;
    }
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com


  2. #2
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,881
    Code:
    .transparent{
      background:rgb(255,255,255); /* For non rgba supportive browsers (yes, IE -- I'm looking at you!) */
      background:rgba(255,255,255,0.6);
    }

  3. #3
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    Shit that was simple...didn't know you could use alpha in the rgb setting.

    Cheers Harry.
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  4. #4
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,881
    No IE support though—considered using a png?

  5. #5
    CSS Freak™ fear2670's Avatar
    Join Date
    Jun 2009
    Location
    SoCal
    Posts
    514
    Quote Originally Posted by Harry View Post
    No IE support though—considered using a png?
    Controlling the CSS Opacity Rate of Child Elements in Transparent Parents in Internet Explorer Martin Ivanov

    But a 1x1 png won't hurt

  6. #6
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    Damn IE...yeah I suppose I could use an image. Would just be nice to achieve the effect without the use of an image.

    When using opacity (and filter) I cannot get the text to go beyond the parent setting. I can still get the effect to work (like your example) but it uses an empty div tag that I positioned behind the paragraph. Yeah I know...not semantically correct :)
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  7. #7
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,881
    filter: isn't ideal CSS as it's not in any specs—it's an IE only property.

    I'd use rgba and be a little 'cutting edge' and use some nice progressive enhancement. Or a png (where you'd have to use another IE proprietary property to get IE6 working).

  8. #8
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508

    thanks for the link Fear, and that may fix the issue in IE, but the parent/child issue is a problem in all browsers.
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  9. #9
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    Quote Originally Posted by Harry View Post
    filter: isn't ideal CSS as it's not in any specs—it's an IE only property.

    I'd use rgba and be a little 'cutting edge' and use some nice progressive enhancement. Or a png (where you'd have to use another IE proprietary property to get IE6 working).

    yeah the only reason I use filter is for the sake of IE.

    "use some nice progressive enhancement" for instance?
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  10. #10
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,881
    View this in IE, then look in Firefox, then in Safari: CSS Wizardry&mdash;CSS3 Examples & Progressive Enhancement

    That's progressive enhancement.

+ Reply to Thread
Page 1 of 5
1 2 3 ... LastLast

Similar Threads

  1. background: transparent;
    By joomlavideos in forum CSS Forum
    Replies: 4
    Last Post: 20-10-2009, 03:35 PM
  2. Transparent Background
    By xtremenorthwest in forum Graphic Design and Web Design Help
    Replies: 10
    Last Post: 23-10-2008, 01:31 PM
  3. Transparent PNG
    By fermanaziz in forum Graphic Design and Web Design Help
    Replies: 1
    Last Post: 15-05-2008, 02:04 PM
  4. inserting text in indesign (creating text art)
    By a3dy in forum Design and Print Software
    Replies: 1
    Last Post: 10-03-2008, 02:47 PM
  5. Transparent Butterfly
    By Toon in forum Photography Forum
    Replies: 9
    Last Post: 06-11-2007, 07:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


The Graphics Forum Web Design Stuff Free Decent Downloads Free Quality Wallpapers Graphics Forum Free Vista Themes
The Top The Best Images Tech Talk 247 Logo Design - $149 Affordable Stock Vector Illustrations Creativecurio - Design Blog Graphic Design Advertising

Check the forum often for the latest design announcements. Everything from graphic design and web design, to films and music. Estetica is a great place for people to get together and help each other out.



Web Hosting - UK Web Hosting services for business or personal website hosting needs.

Dedicated Servers - A full range of Managed Dedicated Server solutions suitable for all your requirements.

Graphic Design Blog | Web Design Forum | Graphic Design and Print Forum | Graphic Design Links | Advertise On This Site

Web Design UK | Vision.To Design | Leaflet Printing | Estetica Design Forum's Privacy Policy

Flyer Printing | Photography Blog | Design Forum Links | Logo Design | Graphic Design Social Network | Logo Design

Graphic Design Tutorials | Logo Designer | UK Logo Design Studio | Land for sale | Vector Art Blog | Leaflet Printing

Free Web Hosting | Custom Logo Design - $149 Only | Affordable Print Design Templates | Small Business Logo Design | Company Logo Design

Logo Design Service | Logo Design Firm | Logo Design Reseller | Custom Logo Design | Letterhead Printing | Flyer Printing | Business Card Printing

Printing | Leaflet Printing | Online Backup | T-Shirt Printing | Personalised Mugs | Canvas Printing | Free Web Hosting Comparison Site