October 26, 1999 - Close Your Tags
![]() |
October 26, 1999 Close Your Tags Tips: October 1999
Yehuda Shiran, Ph.D.
|
<LI>description or <LI>description</LI>. The only difference is the closing </LI> tag, but it might be your biggest mistake. Let's find out why.If you don't close these tags, the browser renders your pages just fine. If you do close your tags, it will render your pages even faster. Take a look at the following code segment:
<P>Here is a list of names:
<UL>
<LI>Yehuda
<LI>Yael
<LI>Tomer
<LI>Dikla
<LI>Carmit
<LI>Alon
</UL>
As you can see, the <P> and <LI> items are included without their closing counterparts. When parsing such HTML code, the browser needs to look ahead to find out where the paragraph or list item ends. The following code generates the same output in a more efficient method:
<P>Here is a list of names:</P>
<UL>
<LI>Yehuda</LI>
<LI>Yael</LI>
<LI>Tomer</LI>
<LI>Dikla</LI>
<LI>Carmit</LI>
<LI>Alon</LI>
</UL>


Find a programming school near you