Style Sheets
  Home arrow Style Sheets arrow 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 
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


    (Page 1 of 6 )

    In this second part of a two-part article, we examine more positioning properties available in the CSS2 specifications, and use what we've learned to build a simple drop-down menu without employing any JavaScript.

    Welcome back! Here we are again, in order to closely look at more CSS Positioning properties. In part 1 of this article, we've explained some basic definitions and explored different commonly used properties. Now, it's time to move forward and find out more about them.

    In this second part, we'll be explaining even more handy properties, and presenting other examples you'll find useful for real client-side applications.

    Let's not waste more time in preliminaries.

    The " float " property

    This property is quite useful to achieve some common effects. One of the most usual techniques is to build floating boxes around image elements, in order to make the content float according to the corresponding image, and display some kind of description. Our example could be implemented by creating a box where all of the images contained are floated to left.

    <style type="text/css">

    #imgbox {

         width: 20%;

         background: #ffc;

         padding: 10px;

         font: normal 11px "Verdana", Arial, Helvetica, sans-serif;

         color: #000;

         border: 1px solid #000;

    }

    #imgbox img {

         float: left;

         margin-right: 10px;

    }

    </style>

    And the markup would be the following:

    <div id="imgbox">

    <img src="css.gif" alt=" CSS are powerful" width="100" height="75" />

    This is a floating box, useful to display some additional content.

    </div>

    The visual output for the above code is illustrated below:

    The float property takes three values. Float is ignored if you have set the "position" property to either absolute or fixed. Let's present the possible values assigned to it:

    float: right;


    The box is floated to the right of the screen.

    float: left;


    The box is floated to the left of the screen.

    float: none;


    The box is not floated.

    This property is often used to implement efficient page layout without the need to absolutely position containing elements, since they're simply floated to the left or right, according to the desired layout effect. For instance, we might have a left navigation bar, a general container for main content and a third bar positioned to the right. Just by making the left bar and main container float to left and the third bar float to the right, we'd have built up a nice three-column layout.

    However, a question remains: how can we properly position an element after a floated element is rendered? That's when the "clear" property becomes very handy. Let's take a look at it.

    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

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - 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...







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