Guild Media
How the Web Was Won - Comentaries and a smattering of tech nerdiness.
Web Design Development Programming, SEO, Internet Marketing
    • About Us
    • Portfolio
      • Flash
        • aspen_en
      • Websites
    • Programming
      • html_en
        • html-escape-codes_en
        • CSS Transparency
      • javascript_en
        • frame-buster_en
        • JavaScript History Object
        • JavaScript Location Object
      • PHP
        • WordPress Plugins
        • Admin Drop Menus for BBPress
    • services_en
      • design_en
      • development_en
      • hosting_en
      • seo_en
    • User defined URI

CSS Transparency

CSS3 transparency has arrived. The holy grail of CSS developers. It allows the transparency to be set for a specific element and is not inherited like the old CSS2 method.

  .transparency_class {color: rgba(255, 255, 255, 0.5);} 

The RGBa let’s you set the RGB values for Red, Green and Blue, like in a regular RGB CSS color, but then adds ‘a’ for the alpha channel. You can use this for anything that can take the CSS color property

Then there is the old CSS2 method, which has patchy implementation across the major browsers. There is one drawback with this method and that being the transparency is inherited by all child elements of the parent to which it has been applied. So that means any text you have inside an element with transparency will take it on also, and depending on how translucent you’ve set the parent, can often render it illegible.

The following class will set the transparency to 50%.

.transparent_class {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}

You will notice a number of declarations.

  • filter:alpha(opacity=50) – is Internet Explorer’s method. I’m not sure about IE8 which has just been recently released. It supposedly is standards compliant. We’ll see.
  • -moz-opacity:0.5 – is the Firefox / Mozilla method. It works in decimal, so complete opacity is set at 1.
  • -khtml-opacity: 0.5 – is the WebKit rendering method, which used in Safari, Google Chrome and Konqueror.
  • opacity: 0.5 – lastly is the standards compliant declaration, which will supposedly one day be the way all of the browsers will implement transparency.
Bookmark to:


Hide Sites
  • Archives

    • ► 2009 (20)
      • September 2009
      • July 2009
      • April 2009
      • March 2009
      • February 2009
    • ► 2008 (29)
      • December 2008
      • November 2008
      • October 2008
      • September 2008
      • August 2008
      • July 2008
      • June 2008
      • March 2008
      • February 2008
      • January 2008
    • ► 2007 (35)
      • December 2007
      • November 2007
      • October 2007
      • September 2007
      • August 2007
      • July 2007
      • June 2007
      • May 2007
      • April 2007
      • March 2007
  • Categories

    • Animation
    • Apple
    • Blog
    • Browsers
    • Censorship
    • Copyright
    • CSS
    • Dell
    • Design
    • eCommerce
    • File Sharing
    • Firefox
    • Fun
    • Google
    • Hacking
    • Hardware
    • HTML5
    • Internet Explorer
    • Internet Marketing
    • Internet TV
    • JavaScript
    • law
    • Learning
    • Linux
    • Microsoft
    • New Media
    • Open Source
    • Open Source Community
    • OS
    • Privacy
    • Programming
    • Search Engines
    • Security
    • SEO
    • Social Networks
    • software
    • Tech Talk
    • Technology
    • The Matrix
    • Uncategorized
    • video
    • Virus
    • VoIP
    • WordPress
  • Blogroll

    • Alan Moore – SMLXL
    • beinArt
    • Kristine Lowe
    • Leo Plaw
    • Media Influencer
    • Rebecca Caroe
  • Firebug - Web Development Evolved
Copyright © 2010 Guild Media All Rights Reserved
RSS XHTML CSS Log in
Powered by Wordpress
This blog is protected by Dave's Spam Karma 2: 51 Spams eaten and counting...