Style Sheets
  Home arrow Style Sheets arrow Creating Web Page Layouts with Negative Ma...
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 
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

Creating Web Page Layouts with Negative Margins
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2008-08-19

    Table of Contents:
  • Creating Web Page Layouts with Negative Margins
  • Building a quick and dirty two-column web page layout
  • Using negative margins to position the main DIVs of a web document
  • Defining an additional wrapping DIV

  • 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 Web Page Layouts with Negative Margins


    (Page 1 of 4 )

    If you regularly use floating DIVs to help your web pages look consistent in a variety of browsers, you'll be very interested in this technique. Instead of using positive margins, it involves using negative margins to help position your DIVs. This article is the first part of a four-part series.

    Introduction

    When web designers started building web page layouts using now-venerable DIVs, a considerable number of approaches emerged quickly. These different techniques demonstrated the numerous advantages of the table-less paradigm.

    Among many crucial things, you've no doubt learned that DIVs could be easily floated to the left and the right of a web document. This facilitates the creation of consistent web page layouts by mean of only a few floating boxes. And to be frank, this technique has proven to be quite successful, particularly in those cases when it's necessary to build web-based front-ends that must be displayed consistently across different browsers.

    In most cases, when floating DIVs are used to build the layout of a web document, they're simply positioned to the left or right side of the pertinent document, according to the number of containing columns that need to be created. Eventually, positive margins are also specified for each of them when this is applicable.

    However, as you probably know, it's also possible to build robust web page layouts that use negative margins to accommodate the containing DIVs within the corresponding web document. This CSS-driven approach was introduced initially by Ryan Brill in his insightful article, and it bases its functionality on pulling out DIVs to the left and the right of a web page by specifying negative values for their respective margins.

    Even though this concept may sound quite easy to understand, the truth is that it can be a bit tricky when it's time to put it into practice. Therefore, assuming that you're interested in expanding your existing background in building DIV-based web page layouts and learning how to use negative margins to position your DIVs, in this group of articles, I'm going to show you numerous code samples regarding the implementation of this useful CSS technique.

    Now, let's get rid of the preliminaries and start learning the key concepts of creating consistent web page layouts using negative margins. Let's get going!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · Negative margins are a popular CSS technique used for building div-based web page...
       · By changing the order <div id="sidecol">...</div><!-- <div...
       · Thanks for commenting on my article. Yes, it’s possible to build variations of the...
     

    STYLE SHEETS ARTICLES

    - Improving the Visual Presentation of a CSS D...
    - Fixing Browser Incompatibilities in a CSS Dr...
    - Building Clean Drop-Down Menus with CSS
    - Creating Hybrid Web Page Layouts with Negati...
    - 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






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