Sunday, March 28, 2010
Basic Rules for HTML Code-1st part
Creating HTML documents is actually quite easy—HTML
documents are simply text files embedded with HTML
commands. You can create the documents with any editor
capable of exporting raw text. In addition, HTML browsers are
very forgiving about white space—additional tabs, line feeds,
or spaces don’t matter.
As you create your first few HTML files, it is important to start
using some good coding habits, habits that will serve you well
as you code more complex pages later on. For example,
consider the practices outlined in the following sections.
Use liberal white space
Insert liberal line breaks to separate code sections, and use
spaces to indent subsequent elements. Both of these will help
you read and understand your code. Consider the following
two code samples:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>The Declaration of Independence</title>
<meta name-"description" content-"Our Nation's
Declaration of Independence"><meta name-"keywords"
content-"declaration, independence,
revolutionary, war, July, 4, 1776"></head><body><h1>The
Declaration of Independence</h1><p>IN CONGRESS, July 4,
1776.</p><p>The unanimous Declaration
of the thirteen united States of America,</p><p>When in the
Course of human events, it becomes necessary for one people
to dissolve the political bands which have connected them
with another, and to assume among the powers of the earth,
the separate and equal station to which the Laws of Nature
and of Nature's God entitle them, a decent respect to the
opinions of mankind requires that they should declare the
causes which impel them to the separation.</p> <p>We hold
these truths to be self-evident, that all men are
created equal, that they are endowed by their Creator with
certain unalienable Rights, that among these are Life,
Liberty and the pursuit of Happiness. . .
and
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>The Declaration of
Independence</title><meta name-"description" content-"Our
Nation's Declaration of Independence">
<meta name-"keywords"content-"declaration, independence,
revolutionary, war, July, 4, 1776">
</head><body>
<h1>The Declaration of Independence</h1><p>IN CONGRESS, July
4, 1776.</p>
<p>The unanimous Declaration of the thirteen united States of
America,</p><p>When in the Course of human events, it becomes
necessary for one people to dissolve the political bands
which have connected them with another, and to assume among
the powers of the earth, the separate and equal station to
which the Laws of Nature and of Nature's God entitle them, a
decent respect to the opinions of mankind requires that they
should declare the causes which impel them to the
separation.</p><p>We hold these truths to be self-evident,
that all men are created equal, that they are endowed by
their Creator with certain unalienable Rights, that among
these are Life, Liberty and the pursuit of Happiness. . .
As you can tell, the second example is much easier to read and, hence, easier to
troubleshoot.
NOTE:SEE Basic Rules for HTML Code-2nd part for more rules


Currently have 0 comments: