SunQuest
 
       Style Sheets
  Home arrow Style Sheets arrow Page 2 - CSS: Top Secret Classification
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  
Actuate Whitepapers 
Moblin 
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

CSS: Top Secret Classification
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-04-14

    Table of Contents:
  • CSS: Top Secret Classification
  • Floating Elements
  • Floating Text for a Fairy Tale Look
  • Creating a Menu

  • 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

    Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!

    CSS: Top Secret Classification - Floating Elements


    (Page 2 of 4 )

    You can make elements float to left or right of text using float. This determines where an image or some text will appear in another element. Here, in the example below, we will float an image to the left and then the right of some paragraphs:


    <html>

    <head>

    <style type="text/css">

    img

    {

    float:left

    }

    img.right

    {

    float:right

    }

    </style>

    </head>

    <body>

    <p>

    <img src="sample.gif" width="100" height="100" />

    Bruce Lee sat staring at the universe, the Milky Way portion particularly. The planet he named Earth when he created it was at the furthest end and he did not like it there, so he round-kicked it into a position closer to the sun. And thus, life on Earth was possible.

    </p>

    <p>

    <img class="right" src="sample.gif" width="100" height="100" />

    On another occasion Bruce Lee got into an argument with the Greek God Zeus. Things quickly escalated, as Bruce will not be disrespected, and he pimp slapped the thunderbolt out of Zeus. The Greek god was so upset he cried for 40 days and 40 nights, forcing God to tell Noah to build the ark. On the forty-first day, Zeus apologized.

    </p>

    </body>

    </html>

    Note that you can always set the float value to none, but then, why bother doing it at all?

    Here is a similar example, where we give an image some border properties and use margins on one of the images so the text does not hug it:


    <html>

    <head>

    <style type="text/css">

    img

    {

    float:left;

    border:1px dashed red;

    margin: 0px 10px 10px 15px

    }

    img.right

    {

    float:right;

    border: 1px dotted blue

    }

    </style>

    </head>

    <body>

    <p>

    <img src="sample.gif" width="100" height="100" />

    Bruce Lee sat staring at the universe, the Milky Way portion particularly. The planet he named Earth when he created it was at the furthest end and he did not like it there, so he round-kicked it into a position closer to the sun. And thus, life on Earth was possible.

    </p>

    <p>

    <img class="right" src="sample.gif" width="100" height="100" />

    On another occasion Bruce Lee got into an argument with the Greek God Zeus. Things quickly escalated, as Bruce will not be disrespected, and he pimp slapped the thunderbolt out of Zeus. The Greek god was so upset he cried for 40 days and 40 nights, forcing God to tell Noah to build the ark. On the forty-first day, Zeus apologized.

    </p>

    </body>

    </html>

    And in this example, we will add a caption to one of our floating images:


    <html>

    <head>

    <style type="text/css">

    div

    {

    float:left;

    border:1px dashed red;

    margin: 10px 10px 10px 15px;

    text-align:center;

    padding:20px

    }

    img.right

    {

    float:right;

    border: 1px dotted blue

    }

    </style>

    </head>

    <body>

    <div>

    <img src="sample.gif" width="100" height="100" /><br />Bruce Lees pwns Joo!

    </div>

    <p>Bruce Lee sat staring at the universe, the Milky Way portion particularly. The planet he named Earth when he created it was at the furthest end and he did not like it there, so he round-kicked it into a position closer to the sun. And thus, life on Earth was possible.

    </p>

    <p>

    <img class="right" src="sample.gif" width="100" height="100" />

    On another occasion Bruce Lee got into an argument with the Greek God Zeus. Things quickly escalated, as Bruce will not be disrespected, and he pimp slapped the thunderbolt out of Zeus. The Greek god was so upset he cried for 40 days and 40 nights, forcing God to tell Noah to build the ark. On the forty-first day, Zeus apologized.

    </p>

    </body>

    </html>

    More Style Sheets Articles
    More By James Payne


       · This article was great. It gave me the information I needed to know and an clear...
       · Thanks for stopping by to read my article. In this issue I discuss such topics as...
     

    STYLE SHEETS ARTICLES

    - 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
    - CSS: Working with Text
    - CSS: Backgrounds
    - CSS for the Newbie






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