HTML
  Home arrow HTML arrow Page 5 - W3C Web Standards
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? 
HTML

W3C Web Standards
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 36
    2004-04-12

    Table of Contents:
  • W3C Web Standards
  • An Eagle's-Eye View
  • First Component: XHTML
  • Attributes
  • Second Component: CSS2
  • Code Explanation
  • Third Component: ECMAScript

  • 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


    W3C Web Standards - Second Component: CSS2


    (Page 5 of 7 )

    If you're not familiar with CSS level 2, and are hoping that this article will make you a guru, I'm sorry to disappoint you! I will point you to W3C's site for CSS2 (http://www.w3.org/TR/REC-CSS2/) if you want a truly in-depth understanding. But honestly, we just need a few basic concepts to work with here.

    You can either use one of your old web pages/templates you may have from a previous project, or you may just wish to start from scratch. For me, I figured that upgrading my site to the new standards was the perfect time to just give it a fresh overhaul. Although, there is a huge advantage in working with an existing page, in that you will get to see with your own eyes that the end result in about 40-60% of the size of the original. Of course, you could just take my word for it!

    Basically, let's go with the assumption that all the pages in our site will be based on one template, just to make this tutorial easier. That means that every page will have the aforementioned DTD and XML declaration at the very top of the page. We are going to lay out all of the elements in the page, and then uniquely identify each. Then, within our global style sheet, we will describe the appearance of the elements, and it will all come together in a wonderfully magical way.

    Let's assume that we have a few basic elements: a logo, a navigation bar, a title, one main area of content, and a footer. Now I know you've already started to plan out your table, your row and column spans, and a few nested tables, but stop! Our HTML code... oops, sorry, our XHTML code could be as simple as this:


    <?xml version="1.0" encoding="UTF-8"? >
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>my standards-compliant page</title>
    </head>
    <body>
    <div id="logo"><img src="/img/logo.gif" /></div>
    <div id="nav">Home Contact me</div>
    <h1 id="header">Home Page</h1>
    <div id="content" align="center">content</div>
    <div id="footer">&copy2004 Acme</div>
    </body>
    </html>

    The first thing we want to do is assign a default font for our site. Black Chancery might be a bit out there, so let's just stick with our good ol' Arial for now, shall we? And we'll set a few other page attributes while we're at it. So the first few lines of our styles.css could be:


    body {
        font
    -familyArialsans-serif;
        font
    -size12px;
        color
    #000000;
        background-color: #FFFFFF;
        margin: 0px;
        padding: 0px;
    }

    Seeing as our cascading style sheet will be cached on the client's browser, these few lines will save us from typing a million <font> tags, or even typing anything whatsoever within our body tags! You could even configure a background image if you're planning to use one. Now let's see what we can do to configure the individual areas of the pages. We'll target each specifically by using the '#' prefix.


    #logo {
        float:left;
        padding: 5px 20px 10px 10px;
    }
     
    #nav {
        text-align: right;
        font-weight: bold;
        font-size: 13px;
        background-image:url("/img/navBox.gif") no-repeat top;
    }
     
    #header {
        font-size: 15px;
        font-weight:bold;
        margin: 5px;
    }
     
    #content {
        width: 400px; /* more readable paragraphs */
        border: 1px solid #666666;
        padding: 10px;
        text-align: left;
    }
     
    #footer {
        color:#333333;
        background-color:#CCCCCC;
        text-align: center;
        font-size: 10px;
    }

    More HTML Articles
    More By Justin Cook


       · Nice article Justin. Clear quiet a few things related to W3C Web Standards.
       · Hi,I have a doubt on this... Is it web standards or xhtml tutorial?
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







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