Graphic Design
  Home arrow Graphic Design arrow Page 4 - Building Corner Effects with Transparent B...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
GRAPHIC DESIGN

Building Corner Effects with Transparent Background Images
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    2008-01-29

    Table of Contents:
  • Building Corner Effects with Transparent Background Images
  • Building rounded corners using a conventional approach
  • Creating transparent background images
  • Creating rounded corners with transparent background images

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building Corner Effects with Transparent Background Images - Creating rounded corners with transparent background images


    (Page 4 of 4 )

    In accordance with the concepts deployed during the prior section, below I included the definition of the same web page that I used earlier, which in this case displays some basic rounded corners inside all of its <h2> headers, of course via the utilization of the transparent background image that you saw before.

    The source code of this sample web page is as follows:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <title>Sample web page with rounded corners (transparent background image)</title>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <style type="text/css">

    body{

    padding: 0;

    margin: 0;

    background: #ccc;

    }

    h1{

    padding: 5px;

    margin: 0;

    font: bold 12px Arial, Helvetica, sans-serif;

    color: #000;

    }

    h2{

    padding: 7px 5px 8px 5px;

    margin: 0;

    background: #6cf url(rounded_corners_transp.gif) center center no-repeat;

    font: bold 12px Arial, Helvetica, sans-serif;

    color: #000;

    }

    p{

    font: normal 12px Arial, Helvetica, sans-serif;

    color: #000;

    }

    #header{

    width: 780px;

    padding: 10px;

    margin-left: auto;

    margin-right: auto;

    background: #ffc;

    }

    #navbar{

    width: 780px;

    padding: 10px;

    margin-left: auto;

    margin-right: auto;

    background: #fff;

    }

    #navbar ul{

    list-style: none;

    }

    #navbar li{

    display: inline;

    padding-right: 4%;

    }

    #navbar a:link,#navbar a:visited{

    font: normal 12px Arial, Helvetica, sans-serif;

    color: #039;

    text-decoration: none;

    }

    #navbar a:hover{

    text-decoration: underline;

    }

    #mainwrapper{

    clear: both;

    width: 800px;

    height: 100%;

    margin-left: auto;

    margin-right: auto;

    overflow: hidden;

    background: #fff;

    }

    #mainwrapper .leftcol{

    position: relative;

    float: left;

    }

    #mainwrapper .rightcol{

    position: relative;

    float: right;

    }

    #leftbar{

    width: 180px;

    padding: 10px;

    }

    #centerbar{

    float: left;

    width: 380px;

    padding: 10px;

    background: #fff;

    }

    #rightbar{

    width: 180px;

    padding: 10px;

    }

    #footer{

    clear: both;

    width: 780px;

    padding: 10px;

    margin-left: auto;

    margin-right: auto;

    background: #ffc;

    }

    .contbox{

    padding: 10px;

    background: #6cf;

    }

    </style>

    </head>

    <body>

    <div id="header">

    <h1>This is the header section of the web page</h1>

    <p>Contents for header section go here. Contents for header section go here. Contents for header section go here. Contents for header section go here.</p>

    </div>

    <div id="navbar">

    <h1>This is the navigation bar of the web page</h1>

    <ul>

    <li><a href="#">Link 1</a></li>

    <li><a href="#">Link 2</a></li>

    <li><a href="#">Link 3</a></li>

    <li><a href="#">Link 4</a></li>

    <li><a href="#">Link 5</a></li>

    <li><a href="#">Link 6</a></li>

    </ul>

    </div>

    <div id="mainwrapper">

    <div id="leftbar" class="leftcol">

    <h2>Left column of the web page</h2>

    <div class="contbox">

    <p>Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here.</p>

    </div>

    </div>

    <div id="centerbar" class="leftcol">

    <h1>Center column of the web page</h1>

    <p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

    <p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

    <p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

    </div>

    <div id="rightbar" class="rightcol">

    <h2>Right column of the web page</h2>

    <div class="contbox">

    <p>Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here.</p>

    </div>

    </div>

    </div>

    <div id="footer">

    <h1>This is the footer section of the web page</h1>

    <p>Contents for footer section go here. Contents for footer section go here. Contents for footer section go here. Contents for footer section go here. Contents for footer section go here.</p>

    </div>

    </body>

    </html>


    Obviously, the only difference here is that now all of the <h2> headers included in the previous sample web page use the transparent background image that was created in the prior section, in this way achieving the famous rounded corner effect. Below I included  an additional picture that illustrates the visual appearance of a container of the mentioned web page, so you can see more clearly how the rounded corners were created:



    So far, so good, right? As you can see, building rounded corners using a few basic transparent images is actually a simple process that can be tackled with minor hassles. Try implementing this approach with your own web sites. Hopefully, you will feel very pleased with the final results.

    Final thoughts

    In this first installment of the series, you hopefully learned how to use some basic transparent background images to create the popular rounded corner effect on a given web page. As you saw previously, this approach is very flexible and easy to follow. This implies that other effects can be built, only changing the shape of the images in question.

    In the next part of the series, I’m going to show you how to implement a concept to build angled corners in different web page elements.

    Now that you’ve been warned, you won’t want to miss it!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Over this first article of the series, you'll see how to utilize a few basic...
     

    GRAPHIC DESIGN ARTICLES

    - Building Corner Effects with Transparent Bac...
    - 3D Graphics Technology: VRML Part I - Introd...
    - Creating Visual Effects
    - Web Page Design Overview
    - Creating Artistic Photographs
    - Working with Tools in Paint Shop Pro 8
    - Using HTML Quickform for Form Processing
    - Introduction to Adobe FrameMaker
    - WebLogic Workshop, WebLogic Platform, and th...
    - Planning the Site
    - Working with Web Services
    - WebLogic Workshop Application Development Ba...
    - Scanning Images for Web Use
    - Web Graphics Overview
    - The Pen is Mightier than the Brush Tool







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek