Microsoft KB Archive/180153

= INFO: The Difference Between the  and  HTML Tags =

Article ID: 180153

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Client Software Development Kit 4.0
 * Microsoft Internet Client Software Development Kit 4.01

-



This article was previously published under Q180153



SUMMARY
This article describes the difference between the  and  HTML tags, which are available in Internet Explorer 4.0x.



MORE INFORMATION
The  tag is a block element used for creating a container to hold and to position other elements. It is commonly used for absolute positioning of content.

The  tag is an inline element that is used to render text by using a style sheet. It is commonly used to change the style of an element, or text within a sentence, or block such as , , or .

Because the  tag cannot create a line break, the following HTML does not behave as you expect:  

 function DoStuff {           txt.innerHTML = "<UL><LI>It worked</UL>"; }     </SCRIPT>

</HEAD> <BODY>

<P> <SPAN ID=txt>HTML to be replaced</SPAN> </P>

<A HREF="javascript:DoStuff">Click Me</A>

</BODY> </HTML> This use of the innerHTML property succeeds if you replace the <SPAN> tag pair with <DIV>.

Because the <SPAN> is not a block element, the <SPAN> does not have an ALIGN attribute. This is unlike a <DIV>.

<div class="references_section">