Style Sheets
  Home arrow Style Sheets arrow Page 5 - Learn CSS, part 1
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

Learn CSS, part 1
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 31
    2005-05-16

    Table of Contents:
  • Learn CSS, part 1
  • CSS Specifications and Implementations
  • Browsers we are going to use
  • The HTML vs. CSS example
  • CSS rules and selectors
  • Groups of Selectors
  • Validating your CSS Documents

  • 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


    Learn CSS, part 1 - CSS rules and selectors


    (Page 5 of 7 )

    As we said before, CSS is a styling language for Web pages. This means that CSS styles mark up elements such as <p>, <h1>, <a> and pretty much all the other elements. In CSS we call the element that we want to style a selector, like the paragraph selector from the above example.

    p
    {
    font-family: Arial, sans-serif;
    color: red;
    }

    We select each and every <p> element in the HTML page to have an Arial font with a red color. The term selector makes sense because you select which part of the page (which element or which elements as we will see shortly) will receive the application of specific styles. So the selector p refers to the HTML element <p>, and so on. You define the actual styling using CSS properties, such as the font-family and color properties. There are many properties in CSS, and we are going to take a look at most (if not all) of them. To set a value to a given property, you write the property followed by a colon, then the value, which must be followed by a semicolon, as shown with the font-family property below:

    font-family: Arial, sans-serif;

    This combination of property, colon, value and semicolon is called a CSS declaration. The combination of the selector (the p) and the declaration is called a CSS rule, which begins with a selector (or a group of selectors as we will discuss shortly), then an opening curly brace "{" followed by as many CSS declarations as you want, followed by a closing curly brace "}". CSS documents consist of CSS rules, which define what styling properties go with what selectors. We will discuss selectors in detail after a few articles in this series, but for now you need to understand that selectors are not just <p>, <a>, <body> and other HTML elements. You can define your own selectors and apply them using the id or class attributes.

    More Style Sheets Articles
    More By Michael Youssef


       · Pretty basic stuff; certainly not bad, though.You can find another (slightly...
       · Hello, I have wrote 10 articles in my Learn CSS Series and most of them have...
       · I have written the following articles in the CSS series in the following order1-...
       · As strictly a web designer (not coder!) that relied on Dreamweaver/HTML for small...
       · W3 is strictly show-and-tell. It doesn't explain the concepts presented. Units of...
     

    STYLE SHEETS ARTICLES

    - 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...
    - Pulling Web Page Elements with the Blueprint...
    - Pushing Web Page Columns with the Blueprint ...
    - Controlling Column Padding with the Blueprin...
    - Prepending Classes in the Blueprint CSS Fram...
    - Appending Grid Units with the Blueprint CSS ...
    - Changing Grid Units in the Blueprint CSS Fra...
    - The Blueprint CSS Framework
    - Building a Liquid Design with Evened Margins...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT