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  
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, Manipulating Colors
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    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
     
     
    ADVERTISEMENT


    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

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - 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...







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