Sunday, March 28, 2010
Basic Rules for HTML Code-2nd part
Posted by devlevis | Sunday, March 28, 2010 | Category:
basic rules for html code,
free html course,
html tricks,
learn html,
using well formed html
|
Use well-formed HTML:
Well-formed HTML means that your documents need to have the following
characteristics:
1) Contain a <DOCTYPE> tag.
2) Elements must be nested, not overlapping. This means that you need to close
elements in the opposite order of how they were opened. For example, the
following example is wrong:
<p>The last word is <b>bold</p></b>
Note how the bold and paragraph tags overlap at the end of the block. Instead,the bold tag should have been closed first, as in the following example:
<p>The last word is <b>bold</b></p>
3) Element and attribute names must be in lowercase. XHTML is case-sensitive;
the tagis different from the tag. All the tags in the XHTML
Document Type Definitions (DTDs) are lowercase—so your documents’ tags
need to be, as well.
4) All non-empty elements must be terminated. For example, the following is not
allowed:
This is one paragraph<p>This is another paragraph<p>
Instead, each open paragraph tag needs to be closed.
5) All attribute values must be quoted. For example, consider the two following
tags:
<table border=0>
and<table border-"0">
The first tag is incorrect because the attribute value is not quoted. The secondis correct because the attribute is correctly quoted.
6)You cannot use minimized attributes, that is, attributes without values. For
example, consider the two following tags:
<input type-"checkbox" checked>
and
<input type-"checkbox" checked-"checked">
The first tag has a minimized attribute; the checked attribute is named but has
no value.
7) Any empty tag must have a closing tag or the opening tag must end with a slash
(/). For example, consider the <hr> tag, which doesn't have a closing tag. As
such, it should always appear with an ending slash, <hr />.
NOTE:SEE Basic Rules for HTML Code-3RD part for more rules
Subscribe to:
Post Comments (Atom)


Currently have 0 comments: