Skip past header
Nevada Department of Transportation Go to State of Nevada Homepage
Jim Gibbons
Governor
Susan Martinovich, P.E.
Director
 

Coding Standards


Mandatory

1. Use a DOCTYPE specification at the beginning of the web page

Netscape 6 and above, Internet Explorer 6 on Windows, and Internet Explorer 5 for Macintosh all support DOCTYPE switching. This is a technique where these browsers can be switched from Quirks mode (which emulates buggy implementations in earlier generation browsers) to Standards mode (which more strictly adhers to the Standards). For new content, use a DOCTYPE which will invoke Standards mode in Netscape Gecko and Internet Explorer 6 AND TEST FOR COMPLIANCE!!! This will ensure that your designs work similarly in these browsers as well as in any other browsers which support the Standards.

Example: for HTML 4.01 Strict

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">


or for XHTML 1.0 Transitional

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2. Tags and attributes must be in lower case

This is because XHTML documents are XML applications. XML is case-sensitive. Tags like <p> and <P> are interpreted as different tags.

This is wrong:

<BODY>
<P><A HREF="My Link">This is not correct</A></P>
</BODY>

This is correct:

<body>
<p><a href="My Link">This is correct</a></p>
</body>


3. Elements must be nested correctly.

This is wrong:

<p><b>This is not correct</p></b>


This is correct:

<p><b>This is correct</b></p>


4. Attribute values must always be quoted.

This is wrong:

<table width=640><tr><td>This is not correct</td></tr></table>

This is correct:

<table width="640"><tr><td>This is correct</td></tr></table>


5. All pages must have a page title. This title will match the heading title at the top of the content section.

Example:

<title>Nevada Department of Transportation Homepage</title>

The template for the internet site automatically meets this requirement by including a PageTitle variable which is used in both the <title> tag and using the variable for the heading.

Note the following code excerpts:

<% PageTitle = "Put page title here" %>
<title><%= PageTitle %></title>
<h1><%= PageTitle %></h1>

6. All pages must have the following "meta" tags:

<meta name="author" content="Author's Name">
<meta name="description" content="Page Description">
<meta name="keywords" content="Search Keywords">
<meta http-equiv="content-type"
   content="text/html;charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">

7. All code should be written so that it is developer tool or IDE independent.

Here are some examples:

Do not use "Frontpage Extensions" elements in Visual Interdev.
Do not require Macromedia Dreamweaver templates for maintaining consistency across pages.

We don't want to be locked into using only one particular IDE for the maintenance-life of a program. This has caused problems in the past. In other words, all web applications should be maintainable with a simple text editor.

Please remember that tools change and that not all developers use the same tools. Have courtesy for the person who must maintain your code using a different tool than you!

8. Modularize code that is used in more than one program and use include or server.execute statements so that changes need to be made in only one place

Pieces of the web page that are used more than once or on more than one page are easier to maintain if they are written in a separate module and then "included" in all the pages using an "Include File" or "server.execute" statement. There is nothing special about an include file; its just a piece of asp or html code. But if you write it generically enough, then you can include it on any page you want as many times as needed.

<!-- #include file="includes/MyDataConnection.asp" -->


for includes within directory structure or

<!-- #include virtual="/includes/MyDataConnection.asp" -->


for includes from root structure of web site

Things that work well as includes:

common functions
data connections
copyright statements
application or subdirectory navigation
anything else you need on more than one page.


Another method of including pages is to use Server.Execute. The syntax is:

<% server.execute "/includes/MyDataConnection.asp" %>

It should be noted that an "Server.Execute" statement transfers control to another html page and then returns control to line after the calling statement.



9. Every website must be designed to reasonably accommodate visitors with disabilities.

At a minimum, all pages within an NDOT website must comply with the current version of Priority 1 Guidelines established by the World Wide Web Consortium's Web Content Accessibility Guidelines. If possible, all pages should also comply with the federal Section 508 Standard and W3C Priority 2 guidelines. Utilize NDOT's accessibility page for further information.

to top



1263 South Stewart Street, Carson City, Nevada 89712 - Telephone: 775-888-7000 - Fax: 775-888-7115 - Email: info@dot.state.nv.us
Copyright © 1998 - 2008 Nevada Department of Transportation
Valid HTML 4.01! Valid CSS!