Style Sheets
  Home arrow Style Sheets arrow Page 3 - Creating Hybrid Web Page Layouts with Nega...
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? 
STYLE SHEETS

Creating Hybrid Web Page Layouts with Negative Margins
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-09-09

    Table of Contents:
  • Creating Hybrid Web Page Layouts with Negative Margins
  • Hybrid layout foundations:
  • Creating a hybrid web page layout with CSS negative margins
  • Completing a hybrid web page layout

  • 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


    Creating Hybrid Web Page Layouts with Negative Margins - Creating a hybrid web page layout with CSS negative margins


    (Page 3 of 4 )

    In consonance with the concepts deployed in the prior section, it’s possible to use negative margins to construct a hybrid web page layout. This layout will be comprised of three main columns, which will be centered in the pertinent web document via a general wrapper that has a fixed width.

    The creation process is pretty straightforward, but to dissipate any doubts about it, take a look at the following CSS styles. They are responsible for constructing the aforementioned hybrid web page layout.


    Here they are:


    /* style header section */

    #header{

    background: #ffc;

    }

    /* style navigation bar */

    #navbar{

    float: left;

    width: 200px;

    background: #ccc;

    }

    /* wraps up the whole page */

    #mainwrapper{

    width: 800px;

    margin-left: auto;

    margin-right: auto;

    }

    /* wraps up the main column */

    #colwrapper{

    float: left;

    width: 100%;

    margin-left: -200px;

    margin-right: -200px;

    }

    /* style main column */

    #maincol{

    margin-right: 200px;

    margin-left: 200px;

    background: #fff;

    }

    /* style side column */

    #sidecol{

    float: right;

    width: 200px;

    background: #ccc;

    }

    /* style footer section */

    #footer{

    clear: both;

    background: #ffc;

    }


    As you can see, in this case I defined a general wrapper, identified as “mainwrapper,” which wraps all of the primary columns of the web document and also has a fixed width of 800px. Then, the respective side bars are pulled away from the center by floating them to the left and the right respectively, and finally the main column is positioned in the document by means of an additional wrapper that uses two negative margins to center the column in question.

    At this point, you hopefully learned how to build a hybrid web page layout using only a pair of CSS negative margins. However, the missing piece of this scheme is the structural markup that must be tied to the previous CSS styles. Therefore, in the final section of this article I’ll be listing the definition of a brand new (X)HTML file, which will include all of the source code required to implement this hybrid web page design.

    To see how the (X)HTML file will be created, please click on the link below and keep reading. We’re almost finished!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This final installment of the series shows how to create an hybrid web page layout...
       · First of all, thanks for the knowledge you have shared in this site.But your...
       · Thanks for the kind words on my CSS article. Yes, negative margins can be a bit...
     

    STYLE SHEETS ARTICLES

    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...
    - Pulling Web Page Elements with the Blueprint...
    - Pushing Web Page Columns with the Blueprint ...
    - Controlling Column Padding with the Blueprin...
    - Prepending Classes in the Blueprint CSS Fram...
    - Appending Grid Units with the Blueprint CSS ...
    - Changing Grid Units in the Blueprint CSS Fra...
    - The Blueprint CSS Framework
    - Building a Liquid Design with Evened Margins...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT