Style Sheets
  Home arrow Style Sheets arrow Page 4 - Using Background Images when Matching Web ...
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  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
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? 
STYLE SHEETS

Using Background Images when Matching Web Page Columns with CSS
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2007-07-24

    Table of Contents:
  • Using Background Images when Matching Web Page Columns with CSS
  • Reviewing some earlier concepts
  • Adding some rounded corners to a web document
  • Listing the complete source code for the rounded-corners example

  • 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


    Using Background Images when Matching Web Page Columns with CSS - Listing the complete source code for the rounded-corners example


    (Page 4 of 4 )

    As I promised in the section that you just read, here is the complete source code belonging to the sample web page that displays its respective main columns fully balanced on the browser. Take a look at it, please:

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-
    8859-1" />
    <style type="text/css">
    body{
       padding: 0;
       margin: 0;
       background: #fff;
    }

    h2{
       margin: 0;
       font: bold 18px 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: #fc0;
    }

    #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: #eee url(roundedbg.gif) center bottom no-repeat;
    }

    #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: #fff;
    }
    </style>
    <title>Example of evened columns - Fixed Design with background image</title>
    </head>
    <body>
     
    <div id="header">
       
    <h2>This is the header section of the web page</h2>
       
    <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">
       
    <h2>This is the navigation bar of the web page</h2>
       
    <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>This is the left column of the web page</h2>
         
    <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 id="centerbar" class="leftcol">
         
    <h2>This is the center column of the web page</h2>
         
    <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>This is the right column of the web page</h2>
         
    <p>Contents for right column go here. Contents for right
    column go here. Contents for right column go here. Contents for
    right column go here. Contents for right column go here.</p>
       
    </div>
     
    </div>
     
    <div id="footer">
       
    <h2>This is the footer section of the web page</h2>
       
    <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>

    There you have it. As you can see, the above code sample displays a fixed web page layout that additionally incorporates a neat rounded corners effect, aside from its respective evened columns.

    This concept can be clarified even more if you have a look at the following screen shot:

    Logically, this approach has some important limitations, since it won't work properly with liquid layouts, but if you need to work with a fixed design and don't want to deal with more complicated techniques, then the method demonstrated here might be a decent solution.

    Final thoughts

    It's sad to mention, but we've come to the end of this series. As you saw in this set of articles, evening the main columns of a given web document is a procedure that can be easily achieved with some basic CSS styles and a basic structural markup.

    However, if a particular web project involves working with more complex web page layouts, you'll need to look into more sophisticated solutions.

    See you in the next web development tutorial!


    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.

       · In this final article of the series, a simple method is showed, in order to...
       · Dear Alejandro,Your articles have been very helpful to a degree student struggling...
       · Hi Graham,Thank you for the kind comments on my web development articles. I...
     

    STYLE SHEETS ARTICLES

    - Creating Three-Column Web Page Layous with N...
    - Swapping Column Positions in Web Page Layout...
    - Creating Web Page Layouts with Negative Marg...
    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification
    - CSS: Dimensions
    - CSS: Margins and Padding
    - CSS: Crossing the Border
    - CSS: Text, Fonts, and Tables







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway