Style Sheets
  Home arrow Style Sheets arrow Page 2 - Introduction to CSS Positioning Properties...
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

Introduction to CSS Positioning Properties Part 2
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2005-02-28

    Table of Contents:
  • Introduction to CSS Positioning Properties Part 2
  • The "clear" property
  • The "z-index" property
  • The "visibility" property
  • The "overflow" property
  • A simple drop-down menu using the "overflow" and "display" properties

  • 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


    Introduction to CSS Positioning Properties Part 2 - The "clear" property


    (Page 2 of 6 )

    This property is used to give control of an element that appears after a floated element. Setting this property on the selected element will ensure that it will appear below any floated boxes that come before it. The possible values taken are the following:

    clear: left;

    The selected element will be displayed below any left-floating boxes being rendered before it.

    clear: right;

    The selected element will be displayed below any right-floating boxes being rendered before it.

    clear: both;

    The selected element will be displayed below any left-floating or right-floating boxes being rendered before it.

    clear: none;

    The selected element will not clear any floating boxes that come before it.

    Let's show some examples that implement this property. Let's suppose that we've created a simple two-column layout, displaying a left-floated navigation bar, and a main container, floated to the right.

    We need to be able to display a footer section after they're visually rendered. Just utilizing the "clear" property, that section is properly located.

    <style type="text/css">

    #navbar {

         float: left;

         width: 20%;

    }

    #content {

         float: right;

         width: 79%;

    }

    #footer {

         clear: both;

    }

    </style>

    And the markup would be the following:

    <div id="navbar"><h2>Navbar</h2></div>

    <div id="content"><h2>Content</h2></div>

    <div id="footer"><h2>Footer</h2></div>

    As we can see, the "footer" section clears the floated elements, and is displayed in the right way. There are many websites using these kinds of hooks to nicely implement page layouts. In fact, the floating approach is quite powerful for achieving several page layouts. It makes it even easier to emulate <table> designs, and the code is a lot more concise.

    More Style Sheets Articles
    More By Alejandro Gervasio


       · In this second part, I describe some useful properties such as float, overflowand...
       · The comments posted previously are comming from me, the author.Thank...
       · Is very misleading while being utterly useless. A menu is a structured list of...
       · Dear Sir,Thank you for stopping at the article and take some time to read...
       · I can't see why you say that "The elements are clickable inside the containing...
       · I'm new to CSS and found your article very helpful. I really like that I could...
       · Hello friend,After analyzing the topic, I ended up with the same conclusion. The...
       · Hello Paul,Thank you for the comments about the article. Regarding the example,...
       · I found Eric's demos of css menus to be a real help as well as this article.You...
       · ( Page 3 of 6 )I'm pretty sure there's a major typo on this page - surely the...
       · Hello friend,Thank you for pointing an excellent resource about the topic. It's...
       · Hi,Yes, You're correct. where it's specified z-index: 1; should read z-index:...
     

    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 2 hosted by Hostway
    Stay green...Green IT