Style Sheets
  Home arrow Style Sheets arrow Page 2 - CSS for the Newbie
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 
IBM developerWorks
 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 for the Newbie
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2008-02-25

    Table of Contents:
  • CSS for the Newbie
  • Putting it all Together
  • Selectors...Unite!
  • Applying a Style to an Element with an Attribute
  • Doing It In Style

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    CSS for the Newbie - Putting it all Together


    (Page 2 of 5 )

    So now that we know the basic syntax of CSS, let's fool around with it some. Open up a text editor and let's get busy.

    Note: Remember that a CSS file is made in a text editor and contains no HTML whatsoever. Also, you must save the file with the .css extention.

    Say we want to create a style sheet so that every time the user uses a <p> tag, it automatically changes the attributes of the text within. Here is how we would do it:


    p {font-family:verdana;text-align:left;color:blue}

    You will note in the above code that we do not place the angle brackets (<>) around our tag. And as I said above, every property is separated by a colon (:). If you wish to change more than one property, then you separate them with the semi-colon (;).

    The above code is a little hard to read, and as you can imagine, it would be even harder on the eyes if we were defining an entire style sheet. A better way to write the code would be like this:


    p

    {

    font-family: Verdana;

    color: blue;

    text-align: left;

    }

    Note that if we had used a value that consisted of more than one word, like a font name such as Times New Roman, we would encase it in quotes, like so: “Times New Roman”.

    More Style Sheets Articles
    More By James Payne


       · Thanks for dropping by to read my article on CSS. In this tutorial we talk about...
     

    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 5 hosted by Hostway