Style Sheets
  Home arrow Style Sheets arrow Page 2 - Learn CSS, Manipulating Colors
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? 
STYLE SHEETS

Learn CSS, Manipulating Colors
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2005-05-30

    Table of Contents:
  • Learn CSS, Manipulating Colors
  • Keywords
  • Using RGB Color Values
  • Haxadecimal Color Values
  • CSS Comments

  • 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

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Learn CSS, Manipulating Colors - Keywords


    (Page 2 of 5 )

    body
    {
      font-family: Tahoma;
      color: mediumslateblue;
    }
    h1
    {
      font-size: 1em;
      border: 2px solid greenyellow;
      background-color: lavender;
    }
    p
    {
      font-size: .7em;
    }

    And here's the HTML code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <link rel="stylesheet" href="paragraph.css" type="text/css">
        <title>Colors with CSS</title>
      </head>
      <body>
        <h1>What's CSS?</h1>
        <p> CSS is a powerful formatting language for the web that is being used with markup languages like HTML, XHTML and XML and that's because the natural of the language. CSS uses the markup element name for applying formatting styles.</p>
        <h1>CSS and Markup Languages</h1>
        <p>You can't use css as a stand-alone styling language because you need something to style, like HTML or XHTML page.</p>
      </body>
    </html>

     

    When you run this page, you will get the following result.

    As you can see, we have been using the CSS 3.0 new named colors to color the background of the <h1> element to lavender, the border of <h1> to greenyellow and the color of the text of the <body> element to mediumslateblue.

    The term "named colors" leads us to the concept of keywords, which is more related to programming languages. A CSS keyword is a word that has a special meaning to web browser implementers. You might know red is the RGB value (255,0,0), but it's very difficult to remember the values for the 147 colors offered by the CSS 3.0 Specifications. That's why browsers replace the keyword red, for example, with the value (255,0,0) and the same to the other 146 color keywords.

    So now that you understand that, you can use keywords as values for properties in CSS. But there's another type of keywords in CSS, the properties. The next selector contains 1 property which is itself a keyword, and its value is a keyword too.

    p
    {
      color: red;
    }

    The color property is a keyword that has a special meaning in CSS. The properties font-size, font-family and the rest of the CSS properties are considered to be keywords. We could write the above CSS file as following, without using keywords

    body
    {
      font-family: Tahoma;
      color: rgb(123,104,238);
    }
    h1
    {
      font-size: 1em;
      border: 2px solid rgb(173,255,47);
      background-color: rgb(230,230,250);
    }
    p
    {
      font-size: .7em;
    }
     

    So let's talk about these RGB Values.

    More Style Sheets Articles
    More By Michael Youssef


     

    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


    Iron Speed





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