 
    
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>li Archives - Complete, Concrete, Concise</title>
	<atom:link href="https://complete-concrete-concise.com/tag/li/feed/" rel="self" type="application/rss+xml" />
	<link>https://complete-concrete-concise.com/tag/li/</link>
	<description>Practical Information Without The Bloat</description>
	<lastBuildDate>Thu, 29 Mar 2018 07:16:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Lists in HTML</title>
		<link>https://complete-concrete-concise.com/tutorials/webdev/front-end-basics/lists-in-html/</link>
		
		<dc:creator><![CDATA[richardsplanet]]></dc:creator>
		<pubDate>Thu, 29 Mar 2018 07:16:05 +0000</pubDate>
				<category><![CDATA[Front-End Basics]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[li]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[ol]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ul]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">https://complete-concrete-concise.com/?p=3482</guid>

					<description><![CDATA[<p>Lists are another way to organize content in your document.</p>
<p>The post <a href="https://complete-concrete-concise.com/tutorials/webdev/front-end-basics/lists-in-html/">Lists in HTML</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="preamble">
HTML5 has a number of ways to organize your data. We have seen how heading tags can be used to divide a document into sections and subsections.<br />
Lists are another way to organize content in your document.
</div>
<p><strong>HTML</strong> provides two different types of lists:</p>
<ul>
<li>unordered lists &#8211; where the order of items doesn’t matter</li>
<li>ordered lists &#8211; where the order of items matters</li>
</ul>
<p>Lists are a little different from the previous tags we’ve seen. Like other HTML tags, they need a start and end tag, but lists are composed of the combination of two different HTML tags:</p>
<ul>
<li>the tags marking the start and end of the list</li>
<li>the tags marking each individual list item</li>
</ul>
<h2>Contents</h2>
<ol type="1">
<li><a href="#list-items">List Items</a></li>
<li><a href="#unordered-lists">Unordered Lists</a></li>
<li><a href="#ordered-lists">Ordered Lists</a>
<ol type="1">
<li><a href="#tag-attributes">Tag Attributes</a></li>
<li><a href="#reversed">reversed</a></li>
<li><a href="#start">start</a></li>
</ol>
</li>
<li><a href="#summary">Summary</a></li>
<li><a href="#playing-around">Playing Around</a></li>
<li><a href="#references">References</a></li>
</ol>
<h2 id="list-items">List Items</h2>
<p>Regardless of whether you use an <strong>unordered list</strong> or an <strong>ordered list</strong>, the contents of that list will always contain <strong>list items</strong>.<br />
List items are enclosed between a starting <span class="kbd">&lt;li&gt;</span> and ending <span class="kbd">&lt;/li&gt;</span> tags.</p>
<div id="cb1" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb1-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;li&gt;</span>This is an item in a list<span class="kw">&lt;/li&gt;</span></code></pre>
</div>
<p>You can place pretty much anything you like inside a <strong>list item</strong> &#8211; including paragraphs, headers, other lists, etc &#8211; as long as they are contained between the opening and closing <span class="kbd">&lt;li&gt;</span> tags.</p>
<h2 id="unordered-lists">Unordered Lists</h2>
<p>Unordered lists are for listing things in which the order doesn’t matter &#8211; for example, the ingredients in a recipe or a safety checklist, etc.<br />
Items in an <strong>unordered list</strong> are contained between a starting <span class="kbd">&lt;ul&gt;</span> and ending <span class="kbd">&lt;/ul&gt;</span> tags.</p>
<div id="cb2" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb2-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;ul&gt;</span>
<a id="cb2-2" class="sourceLine" data-line-number="2"></a>
<a id="cb2-3" class="sourceLine" data-line-number="3"></a><span class="kw">&lt;/ul&gt;</span></code></pre>
</div>
<p>Since the above list doesn’t contain any items, there is nothing to be seen in the document. It is an error to have an empty list.</p>
<div id="cb3" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb3-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;ul&gt;</span>
<a id="cb3-2" class="sourceLine" data-line-number="2"></a>  <span class="kw">&lt;li&gt;</span>This is an item in a list<span class="kw">&lt;/li&gt;</span>
<a id="cb3-3" class="sourceLine" data-line-number="3"></a>  <span class="kw">&lt;li&gt;</span>This is another item in a list.<span class="kw">&lt;/li&gt;</span>
<a id="cb3-4" class="sourceLine" data-line-number="4"></a>  <span class="kw">&lt;li&gt;</span>This is a complex list item.
<a id="cb3-5" class="sourceLine" data-line-number="5"></a>    <span class="kw">&lt;p&gt;</span>We have a paragraph embedded in it.<span class="kw">&lt;/p&gt;</span>
<a id="cb3-6" class="sourceLine" data-line-number="6"></a>    <span class="kw">&lt;h3&gt;</span>We also have a level 3 heading embeded.<span class="kw">&lt;/h3&gt;</span>
<a id="cb3-7" class="sourceLine" data-line-number="7"></a>    <span class="kw">&lt;p&gt;</span>And close off with a final paragraph.<span class="kw">&lt;/p&gt;</span>
<a id="cb3-8" class="sourceLine" data-line-number="8"></a>  <span class="kw">&lt;/li&gt;</span>
<a id="cb3-9" class="sourceLine" data-line-number="9"></a>  <span class="kw">&lt;li&gt;&lt;p&gt;</span>This is another complex list item because it
<a id="cb3-10" class="sourceLine" data-line-number="10"></a>    contains another list inside.<span class="kw">&lt;/p&gt;</span>
<a id="cb3-11" class="sourceLine" data-line-number="11"></a>    <span class="kw">&lt;ul&gt;</span>
<a id="cb3-12" class="sourceLine" data-line-number="12"></a>      <span class="kw">&lt;li&gt;</span>Item 1<span class="kw">&lt;/li&gt;</span>
<a id="cb3-13" class="sourceLine" data-line-number="13"></a>      <span class="kw">&lt;li&gt;</span>Item 2<span class="kw">&lt;/li&gt;</span>
<a id="cb3-14" class="sourceLine" data-line-number="14"></a>      <span class="kw">&lt;li&gt;</span>Item 3<span class="kw">&lt;/li&gt;</span>
<a id="cb3-15" class="sourceLine" data-line-number="15"></a>    <span class="kw">&lt;/ul&gt;</span>
<a id="cb3-16" class="sourceLine" data-line-number="16"></a>  <span class="kw">&lt;/li&gt;</span>
<a id="cb3-17" class="sourceLine" data-line-number="17"></a><span class="kw">&lt;/ul&gt;</span></code></pre>
</div>
<p>Obviously, the code fragment above should be embedded inside a standard HTML5 document structure.<a id="fnref1" class="footnote-ref" href="#fn1"><sup>1</sup></a></p>
<h2 id="ordered-lists">Ordered Lists</h2>
<p>Ordered lists are for listing things that have a specific order or enumeration &#8211; for example, a top 10 list, or step-by-step instructions.<br />
Items in an <strong>ordered list</strong> are contained between a starting <span class="kbd">&lt;ol&gt;</span> and ending <span class="kbd">&lt;/ol&gt;</span> tags.</p>
<div id="cb4" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb4-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;ol&gt;</span>
<a id="cb4-2" class="sourceLine" data-line-number="2"></a>
<a id="cb4-3" class="sourceLine" data-line-number="3"></a><span class="kw">&lt;/ol&gt;</span></code></pre>
</div>
<p>Since the above list doesn’t contain any items, there is nothing to be seen in the document. It is an error to have an empty list.</p>
<div id="cb5" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb5-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;ol&gt;</span>
<a id="cb5-2" class="sourceLine" data-line-number="2"></a>  <span class="kw">&lt;li&gt;</span>This is an item in a list<span class="kw">&lt;/li&gt;</span>
<a id="cb5-3" class="sourceLine" data-line-number="3"></a>  <span class="kw">&lt;li&gt;</span>This is another item in a list.<span class="kw">&lt;/li&gt;</span>
<a id="cb5-4" class="sourceLine" data-line-number="4"></a>  <span class="kw">&lt;li&gt;</span>This is a complex list item.
<a id="cb5-5" class="sourceLine" data-line-number="5"></a>    <span class="kw">&lt;p&gt;</span>We have a paragraph embedded in it.<span class="kw">&lt;/p&gt;</span>
<a id="cb5-6" class="sourceLine" data-line-number="6"></a>    <span class="kw">&lt;h3&gt;</span>We also have a level 3 heading embeded.<span class="kw">&lt;/h3&gt;</span>
<a id="cb5-7" class="sourceLine" data-line-number="7"></a>    <span class="kw">&lt;p&gt;</span>And close off with a final paragraph.<span class="kw">&lt;/p&gt;</span>
<a id="cb5-8" class="sourceLine" data-line-number="8"></a>  <span class="kw">&lt;/li&gt;</span>
<a id="cb5-9" class="sourceLine" data-line-number="9"></a>  <span class="kw">&lt;li&gt;&lt;p&gt;</span>This is another complex list item because it
<a id="cb5-10" class="sourceLine" data-line-number="10"></a>    contains another list inside.<span class="kw">&lt;/p&gt;</span>
<a id="cb5-11" class="sourceLine" data-line-number="11"></a>    <span class="kw">&lt;ol&gt;</span>
<a id="cb5-12" class="sourceLine" data-line-number="12"></a>      <span class="kw">&lt;li&gt;</span>Item 1<span class="kw">&lt;/li&gt;</span>
<a id="cb5-13" class="sourceLine" data-line-number="13"></a>      <span class="kw">&lt;li&gt;</span>Item 2<span class="kw">&lt;/li&gt;</span>
<a id="cb5-14" class="sourceLine" data-line-number="14"></a>      <span class="kw">&lt;li&gt;</span>Item 3<span class="kw">&lt;/li&gt;</span>
<a id="cb5-15" class="sourceLine" data-line-number="15"></a>    <span class="kw">&lt;/ol&gt;</span>
<a id="cb5-16" class="sourceLine" data-line-number="16"></a>  <span class="kw">&lt;/li&gt;</span>
<a id="cb5-17" class="sourceLine" data-line-number="17"></a><span class="kw">&lt;/ol&gt;</span></code></pre>
</div>
<p>Obviously, the code fragment above should be embedded inside a standard HTML5 document structure.<br />
The <strong>list items</strong> are numbered sequentially and in ascending order beginning from 1.</p>
<h3 id="tag-attributes">Tag Attributes</h3>
<p>All HTML elements can have additional information embedded in the <span class="kbd">&lt;start&gt;</span> tag. This information is known as <strong>attributes</strong>.<br />
Attributes provide additional information to the web client about the HTML element.<br />
As with HTML tags, <strong>attribute</strong> names are case-insensitive.</p>
<h3 id="reversed">reversed</h3>
<p>The <strong>reversed</strong> attribute indicates that the numbering should be in reverse order &#8211; i.e. descending.<br />
Place the tag inside the opening <span class="kbd">&lt;ol&gt;</span> tag and the browser will reverse the displayed order of the numbers. It <em>only</em> changes the number ordering, it does <em>not</em> change the ordering of the items in the list.</p>
<div id="cb6" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb6-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;p&gt;</span>Normal list ordering:<span class="kw">&lt;/p&gt;</span>
<a id="cb6-2" class="sourceLine" data-line-number="2"></a><span class="kw">&lt;ol&gt;</span>
<a id="cb6-3" class="sourceLine" data-line-number="3"></a>  <span class="kw">&lt;li&gt;</span>Item one<span class="kw">&lt;/li&gt;</span>
<a id="cb6-4" class="sourceLine" data-line-number="4"></a>  <span class="kw">&lt;li&gt;</span>Item two<span class="kw">&lt;/li&gt;</span>
<a id="cb6-5" class="sourceLine" data-line-number="5"></a>  <span class="kw">&lt;li&gt;</span>Item three<span class="kw">&lt;/li&gt;</span>
<a id="cb6-6" class="sourceLine" data-line-number="6"></a><span class="kw">&lt;/ol&gt;</span>
<a id="cb6-7" class="sourceLine" data-line-number="7"></a>
<a id="cb6-8" class="sourceLine" data-line-number="8"></a><span class="kw">&lt;p&gt;</span>Reversed list ordering:<span class="kw">&lt;/p&gt;</span>
<a id="cb6-9" class="sourceLine" data-line-number="9"></a><span class="kw">&lt;ol</span><span class="ot"> reversed</span><span class="kw">&gt;</span>
<a id="cb6-10" class="sourceLine" data-line-number="10"></a>  <span class="kw">&lt;li&gt;</span>Item one<span class="kw">&lt;/li&gt;</span>
<a id="cb6-11" class="sourceLine" data-line-number="11"></a>  <span class="kw">&lt;li&gt;</span>Item two<span class="kw">&lt;/li&gt;</span>
<a id="cb6-12" class="sourceLine" data-line-number="12"></a>  <span class="kw">&lt;li&gt;</span>Item three<span class="kw">&lt;/li&gt;</span>
<a id="cb6-13" class="sourceLine" data-line-number="13"></a><span class="kw">&lt;/ol&gt;</span>
<a id="cb6-14" class="sourceLine" data-line-number="14"></a>
<a id="cb6-15" class="sourceLine" data-line-number="15"></a><span class="kw">&lt;p&gt;</span>Notice the order of the list items does not change.<span class="kw">&lt;/p&gt;</span></code></pre>
</div>
<h3 id="start">start</h3>
<p>Sometimes you might need to start the list numbering at a value other than 1 &#8211; this can be done using the <strong>start</strong> attribute. Unlike the <strong>reversed</strong> attribute, the <strong>start</strong> attribute consists of a <strong>name &#8211; value</strong> pair. While the <strong>name</strong> is case-insensitive, the <strong>value</strong> may be case-sensitive (depends on what kind of value it is). The <strong>value</strong> is always between single (<strong>’</strong>) or double (<strong>&#8220;</strong>) quotes:</p>
<div id="cb7" class="sourceCode">
<pre class="sourceCode html"><code class="sourceCode html"><a id="cb7-1" class="sourceLine" data-line-number="1"></a><span class="kw">&lt;p&gt;</span>Normal list ordering:<span class="kw">&lt;/p&gt;</span>
<a id="cb7-2" class="sourceLine" data-line-number="2"></a><span class="kw">&lt;ol&gt;</span>
<a id="cb7-3" class="sourceLine" data-line-number="3"></a>  <span class="kw">&lt;li&gt;</span>Item one<span class="kw">&lt;/li&gt;</span>
<a id="cb7-4" class="sourceLine" data-line-number="4"></a>  <span class="kw">&lt;li&gt;</span>Item two<span class="kw">&lt;/li&gt;</span>
<a id="cb7-5" class="sourceLine" data-line-number="5"></a>  <span class="kw">&lt;li&gt;</span>Item three<span class="kw">&lt;/li&gt;</span>
<a id="cb7-6" class="sourceLine" data-line-number="6"></a><span class="kw">&lt;/ol&gt;</span>
<a id="cb7-7" class="sourceLine" data-line-number="7"></a>
<a id="cb7-8" class="sourceLine" data-line-number="8"></a><span class="kw">&lt;p&gt;</span>List with a different start:<span class="kw">&lt;/p&gt;</span>
<a id="cb7-9" class="sourceLine" data-line-number="9"></a><span class="kw">&lt;ol</span><span class="ot"> start=</span><span class="st">"101"</span><span class="kw">&gt;</span>
<a id="cb7-10" class="sourceLine" data-line-number="10"></a>  <span class="kw">&lt;li&gt;</span>Item one<span class="kw">&lt;/li&gt;</span>
<a id="cb7-11" class="sourceLine" data-line-number="11"></a>  <span class="kw">&lt;li&gt;</span>Item two<span class="kw">&lt;/li&gt;</span>
<a id="cb7-12" class="sourceLine" data-line-number="12"></a>  <span class="kw">&lt;li&gt;</span>Item three<span class="kw">&lt;/li&gt;</span>
<a id="cb7-13" class="sourceLine" data-line-number="13"></a><span class="kw">&lt;/ol&gt;</span>
<a id="cb7-14" class="sourceLine" data-line-number="14"></a>
<a id="cb7-15" class="sourceLine" data-line-number="15"></a><span class="kw">&lt;p&gt;</span>Using different <span class="kw">&lt;strong&gt;</span>start<span class="kw">&lt;/strong&gt;</span> values allows
<a id="cb7-16" class="sourceLine" data-line-number="16"></a>  you to continue a list over several pages.<span class="kw">&lt;/p&gt;</span></code></pre>
</div>
<h2 id="summary">Summary</h2>
<p>HTML provides two different types of lists:</p>
<ul>
<li>unordered lists (<span class="kbd">&lt;ul&gt;</span>) &#8211; where the order of items doesn’t matter</li>
<li>ordered lists (<span class="kbd">&lt;ol&gt;</span>) &#8211; where the order of items matters</li>
</ul>
<p>Lists are composed of the combination of two different HTML tags:</p>
<ul>
<li>the tags marking the start and end of the list (<span class="kbd">&lt;ul&gt;</span> or <span class="kbd">&lt;ol&gt;</span>)</li>
<li>the tags marking each individual list item (<span class="kbd">&lt;li&gt;</span>)</li>
</ul>
<p>All HTML elements can have <strong>attributes</strong> which give the <strong>client</strong> additional information about the element.<br />
Ordered lists can use the <strong>attributes</strong>:</p>
<ul>
<li><strong>reversed</strong> &#8211; to indicate the numbering should be in descending order</li>
<li><strong>start</strong> &#8211; to indicate the starting number for the lists</li>
</ul>
<p>List should be used to structure the information in the document, not for indenting.</p>
<h2 id="playing-around">Playing Around</h2>
<p>The best way to learn is to play around with what you have learned.<br />
Some webpage ideas are:</p>
<ul>
<li>your resume (or curriculum vitae) &#8211; depending on how your C.V. is structured, you may have items that are listed</li>
<li>a recipe &#8211; recipes usually have an unordered list of ingredients and an ordered list of instructions.</li>
</ul>
<h2 id="references">References</h2>
<ol type="1">
<li><a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element"><span class="kbd">&lt;ul&gt;</span> tag</a></li>
<li><a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element"><span class="kbd">&lt;ol&gt;</span> tag</a></li>
<li><a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element"><span class="kbd">&lt;li&gt;</span> tag</a></li>
</ol>
<div class="prev">
<a href="https://complete-concrete-concise.com/tutorials/webdev/front-end-basics/a-recipe-example">Prev</a>
</div>
<div class="next">
<a href="https://complete-concrete-concise.com/tutorials/webdev/front-end-basics/a-recipe-example-using-lists">Next</a>
</div>
<div class="clear"></div>
<section class="footnotes">
<hr />
<ol>
<li id="fn1">If you tried to view simply the fragment as is, you may have been surprised to notice that it rendered correctly (or mostly correctly). This is because HTML is supposed to be resilient &#8211; errors that that cause it to stop working are a bad thing. So, unlike most other languages, HTML errors are not supposed to interfere with the process of displaying the document contents. HTML clients try to correct the error as much as possible. The goal is to display the information contained in the document.<br />
This does not give you a license to write bad HTML code. It also makes debugging HTML code much more difficult.<a class="footnote-back" href="#fnref1">↩</a></li>
</ol>
</section>
<p>The post <a href="https://complete-concrete-concise.com/tutorials/webdev/front-end-basics/lists-in-html/">Lists in HTML</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
