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  
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

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


    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

    - Building Rounded Corners with CSS3`s -webkit...
    - Using the Custom -moz-border-radius Property...
    - Using CSS3`s Border-Radius Property to Build...
    - Adding Semantic Meaning to Styled Code Block...
    - Styling Code blocks with CSS: Using pre HTML...
    - Building Rounded Corners with CSS3
    - Finishing a Casual Navigation Bar with CSS S...
    - Defining a Navigation Bar`s Hover State with...
    - Styling a Blog`s Links Bar with CSS Sprites
    - Creating an Artistic Blog Header with CSS Sp...
    - Defining the Active State of Menu Sections f...
    - Styling the Hover State of a CSS Sprite-Base...
    - Building CSS Sprite-Based Navigation Bars
    - Creating Framed Pictures with CSS
    - Using a CSS Shading Effect to Decorate Images







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