Optimalworks Ltd web design, SEO, training and consultancy 

the site completely surpassed my expectations GT, AutoDirector, we build websites that work, my website is great - I love it MP, XL Autos, reach more customers, make more sales, it's more than I ever could have expected LM, Trade Cars UK, we can help your business grow, 99% of business now comes from my website GV, Bash Events, promoting standards throughout the web industry, your contribution added a level of quality we would otherwise have struggled to achieve PS, Hemsley Fraser
  1. home
  2. Services
  3. Portfolio
  4. Contact us
  5. blog

Using CSS to create Vista-like Aero effects

written by Craig, 22 June 2007

Vista-like Aero effects are all the rage. Who wants dull block colours, when you can overlay a semi-transparent misty glass effect?!

When it comes to replicating Aero on a web page, designers often resort to alpha-transparent PNGs (which are not directly supported by IE6.0 and below), non-standard CSS (which will not work in all browsers), or JavaScript transparency effects (which fail if JavaScript is not enabled). Even with these solutions, it is not possible to achieve the glass diffusion effect.

The following tutorial shows how you can create a CSS-based Aero effect (view example) that works in most graphical browsers: IE5.0+, Firefox 1.0+, Opera, and Safari.

  1. Create your ‘normal’ background image, e.g. cssaero_back.jpg:
    background
  2. Apply a little blurring, lighten the image, or use filters to create the ‘over-effect’ you require. Save this as a different file, e.g. cssaero_over.jpg
    background
  3. For our page, we will create a menu that is positioned on the right of our background. The basic XHTML: <div id="back"> <ol> <li><a href=”#”>first link</a></li> <li><a href=”#”>second link</a></li> <li><a href=”#”>third link</a></li> </ol> </div>
  4. We now use CSS to apply the normal background to the #back DIV element, i.e. #back { width: 400px; height: 300px; background: url(”cssaero_back.jpg”) 0 0 no-repeat; overflow: hidden; }
  5. The Aero background is now applied to the OL element. Since we are floating the list to the right, the graphic is also positioned 100% to the right. ol { float: right; width: 8em; height: 100%; list-style-type: none; background: url(”cssaero_over.jpg”) 100% 0 no-repeat; }
  6. Finally, we can add some minor effects to the LI and A elements, i.e. li { border-top: 1px solid #4d90aa; } a { display: block; width: 100%; text-align: center; text-decoration: none; padding: 0.2em 0; color: #fff; border-bottom: 1px solid #325e6d; }

Our code is now complete - view the example CSS Aero menu. The effect will still work if you resize your browser text or change the menu width.

The same technique can be used for other elements, such as titles. You can also absolutely position the element using percentage values and alter the over-effect graphic background position accordingly.

  • categories: css
  • tags: css, graphics
  • trackback: http://www.optimalworks.net/blog/2007/web-development/css/css-vista-aero/trackback
  • bookmark: del.icio.us, digg, facebook, reddit, Furl, Spurl, Blinklist, Slashdot, Technorati, Yahoo!
add your comments
please enter your name
please enter your email address - it will not be published anywhere
please enter your website address
please enter your comments (all are moderated and checked for spam)
  • next article: JavaScript in-place document updates 
  • previous article: TACS - free PHP template and caching script 
search
  • all popular (5)
  • courses (1)
  • general (3)
  • hardware (1)
  • software (24)
    • free download (6)
    • web browsers (9)
    • web servers (2)
  • web development (31)
    • accessibility (4)
    • ajax (1)
    • css (2)
    • graphic design (4)
    • html (1)
    • javascript (7)
    • php (4)
    • seo (1)

tags

  • accessibility
  • ajax
  • apache
  • award
  • computing
  • css
  • design
  • developers
  • dom
  • download
  • editor
  • firefox
  • funny
  • graphics
  • hardware
  • html
  • ie
  • javascript
  • opera
  • php
  • portfolio
  • review
  • safari
  • seo
  • server
  • software
  • ssl
  • standards
  • wordpress
  • xml
  1. site map
  2. home
  3. Services
  4. Portfolio
  5. Contact us
  6. blog
  7. RSS feed
  8. project survey

XHTML 1.0 | CSS 2.1 | WAI AAA | printer-friendly

©2008 Optimalworks Ltd, Devon, UK. Registered in England and Wales No. 5922205.

This page can be viewed at http://www.optimalworks.net/blog/2007/web-development/css/css-vista-aero