SunQuest
 
       HTML
  Home arrow HTML arrow Page 3 - CSS: Where Little Things Mean a Lot
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 
VeriSign Whitepapers 
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? 
HTML

CSS: Where Little Things Mean a Lot
By: Christopher Duell
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 27
    2004-03-29

    Table of Contents:
  • CSS: Where Little Things Mean a Lot
  • On to CSS
  • CSS and the DIV Tag

  • 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
     
    Iron Speed
     
    ADVERTISEMENT

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    CSS: Where Little Things Mean a Lot - CSS and the DIV Tag


    (Page 3 of 3 )

    OK, so you’re convinced now right?  I’m sure you’d like to know just how powerful this file really is. Here is the answer:

    Almost everything can be controlled by this file including (to an extent) the overall layout of your site.  Some sites, like Wired.com, have created their entire site with the use of CSS to control their layout. As you will see, they’ve employed a fairly complex layout--all through the use of CSS!

    I will let you in on a secret though, they make extensive use of the <div> tag. This is a block level element, meaning that it will live on it’s own line unless told otherwise, in much the same way that a <blockquote> tag will be on its own line, and not ‘inline’ with anything else.  In each <div> tag you can set what ‘class’ (or type) of section of the site it will hold, for example you could change the HTML file to have:

    <div class=”title”Examples 'R' Us</div>

    Viewing this will be no different to what it was before, unless we change the CSS file accordingly to alter the settings for this class, for example:


    div.title{
    width
    :100%;
    height
    :25px;
    background
    #FF0000;
    border-style: solid;
    border-color: #FFFFFF;
    border-width: 2px;
    }

    Now looking at the web page, it has changed again to represent the changes made to the CSS file. To see some of the other features of CSS displayed download the support file for this article (available here).  By having a look at the accompanying files, you will see that two extra <div> tags were added; one named ‘side’ and another named ‘main’.  Each has their own different style which is controlled entirely by the Style Sheet (CSS file).

    Looking at the Style Sheet attached to the support file, you will also notice that the ‘a’ (anchor) tag has also had an overhaul.  Instead of having the default blue-colored underlined links, the code in the Style Sheet now tells the browser to display links in red, with no underline.  When the mouse goes over the link, they change to blue, with an underline and overline to catch the viewer’s attention.  A few other changes have been made to the original Style Sheet that we created earlier, but nothing that you shouldn’t be able to spot.

    Your next step is to check out a site that lists all the elements that you can play with using CSS and what you can do with each element.  This article was only a tip of the CSS iceberg. The powers of CSS are too huge to contain in one article, so I would suggest that you purchase a book on CSS, as you will find yourself looking it up time after time to get your site to look just the way you want.

    Happy coding!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    HTML ARTICLES

    - Another Look at Animation of Geographical Ma...
    - Animation of Geographical Map Regions
    - Changing and Moving Pictures with CSS
    - Clickable Geographical Map Regions
    - Gradient Creation with the HR Element
    - Text on HTML Images: Do it Yourself
    - Custom Buttons in HTML
    - Quick Web Page Menu
    - Maximizing and Restoring HTML Images with th...
    - Maximizing and Restoring HTML Images with th...
    - Handling Hyperlinks and Images in HTML
    - Quick Start with HTML
    - HTML Tips
    - Color Composition and HTML
    - HTML Fonts, Styles, and Headers


    Iron Speed





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