avatarThon Ly

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

15887

Abstract

span><span class="hljs-tag"></<span class="hljs-name">h1</span>></span> Heading 2 = <span class="hljs-tag"><<span class="hljs-name">h2</span>></span><span class="hljs-tag"></<span class="hljs-name">h2</span>></span> Heading 3 = <span class="hljs-tag"><<span class="hljs-name">h3</span>></span><span class="hljs-tag"></<span class="hljs-name">h3</span>></span> Heading 4 = <span class="hljs-tag"><<span class="hljs-name">h4</span>></span><span class="hljs-tag"></<span class="hljs-name">h4</span>></span> Heading 5 = <span class="hljs-tag"><<span class="hljs-name">h5</span>></span><span class="hljs-tag"></<span class="hljs-name">h5</span>></span> Heading 6 = <span class="hljs-tag"><<span class="hljs-name">h6</span>></span><span class="hljs-tag"></<span class="hljs-name">h6</span>></span></pre></div><p id="0162"><b>Heading 1</b> should be used for the <i>highest</i> heading levels while <b>heading 6</b> should be used for the <i>lowest</i> heading levels.</p><div id="b059"><pre>Heading <span class="hljs-number">1</span> <span class="hljs-operator">=</span>> Highest Heading <span class="hljs-number">6</span> <span class="hljs-operator">=</span>> Lowest</pre></div><p id="2460">Referencing <a href="https://flat.io">Flat</a> for instance, this could be <b>heading 1</b>:</p><figure id="344d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*boATWR8X4URqcDw_rHfVnA.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><p id="8561">While this could be <b>heading 2</b>:</p><figure id="d89e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Vd4JpCzHYByp3MqAF8yjDQ.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><p id="6693">And this could also be <b>heading 2</b>:</p><figure id="6fc4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*a6Qt8YQtb6VHSo4DR1OQUQ.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><p id="a7d1">We could use a <b>paragraph</b> tag for this description:</p><figure id="0eab"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*VBE5DhZ6oJcedq6lmvFhlA.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><div id="2f65"><pre>paragraph <span class="hljs-keyword">tag</span> <span class="hljs-title">= <p</span>><span class="hljs-tag"></p></span></pre></div><p id="17b9">A <b>button</b> tag for this button:</p><figure id="1bfd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*dT-5TZXxW9WgqtALakSxkQ.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><div id="0420"><pre>button <span class="hljs-keyword">tag</span> <span class="hljs-title">= <button</span>><span class="hljs-tag"></button></span></pre></div><p id="bfd8">And an <b>image</b> tag for this image:</p><figure id="58c1"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*lT1rm0hYwvgx2K3deZX5bA.png"><figcaption><a href="https://prod-site.flat-cdn.com/img/f42b25c.webp">https://prod-site.flat-cdn.com/img/f42b25c.webp</a></figcaption></figure><div id="2da7"><pre>image <span class="hljs-keyword">tag</span> <span class="hljs-title">= <img</span> /></pre></div><p id="d1eb">We could use <b>anchor</b> tags for these <i>links</i> in the <code><b>header</b></code>:</p><figure id="4e1e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*wBsGqyqzQbXtnT4ihXWO9A.png"><figcaption></figcaption></figure><p id="0136">And these links in the <code><b>footer</b></code>:</p><figure id="772e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*o_9UdP7zofZirdpekcrabg.png"><figcaption><a href="https://flat.io/">https://flat.io</a></figcaption></figure><div id="3ff4"><pre><span class="hljs-built_in">anchor</span> <span class="hljs-keyword">tag</span> = <span class="hljs-variable"><a></span></a></pre></div><p id="0798">In the HTML code, we can also easily model this:</p><div id="e06f"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span><span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span><span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="5a3f">Inside <code>nav</code> in the <code><b>header</b></code>, we can add as many <b>anchor</b> tags as necessary for the <b>menu</b>:</p><div id="1259"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span><span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="bd05"><b>Anchor</b> is shortened to just <code>a</code> because it’s used very often.</p><p id="ddc3" type="7">Remember, the shorter the tag names, the more popular they are!</p><p id="9e1d">We could also add as many <b>anchor</b> tags as necessary for the <b>sitemap</b> inside the <code>nav</code> in the <code><b>footer</b></code>:</p><div id="9d29"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="7a45">Inside the <b>first</b> <b>subsection</b> of <code><b>main</b></code>, we can add a <b>heading 1</b> tag:</p><div id="5a56"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h1></span><span class="hljs-section"></h1></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="a699">Inside the <b>second</b> and <b>third</b> <b>subsections</b>, we can add <b>heading 2 </b>tags:</p><div id="99d8"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h1></span><span class="hljs-section"></h1></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="87f4">Again, <b>heading</b> is shortened to just <code>h</code> because it’s used very often.</p><p id="659e">Inside the <b>first subsection</b>, we can add a <code>p</code> tag for the <b>paragraph</b> description, a <code>button</code> tag for the <b>button</b>, and an <code>img</code> tag for the <b>image</b>:</p><div id="9e5e"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h1></span><span class="hljs-section"></h1></span> <span class="hljs-section"><p></span><span class="hljs-section"></p></span> <span class="hljs-section"><button></span><span class="hljs-section"></button></span> <span class="hljs-section"><img /></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="3f86">Again, these kinds of tags are called <b>content tags </b>because they contain <i>actual content</i>.</p><div id="2fa6"><pre><span class="hljs-built_in">content</span> tags => actual <span class="hljs-built_in">content</span></pre></div><p id="eb13">When we use the right kind that<i> <b>describes its content</b></i>, we will further make our page <i>search engine friendly</i> and <i>screen reader friendly</i>.</p><blockquote id="93b8"><p>In Lesson 16 and 17, we will dive much deeper into <b>content tags</b>!</p></blockquote><p id="7bad">The finished <a href="https://codepen.io/thonly/pen/yLMVYYj?editors=1000">Codepen</a>:</p> <figure id="8c2b"> <div> <div> <img c

Options

lass="ratio" src="http://placehold.it/16x9"> <iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fthonly%2Fembed%2Fpreview%2FyLMVYYj%3Fdefault-tabs%3Dhtml%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DyLMVYYj&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fthonly%2Fpen%2FyLMVYYj%3Feditors%3D1000&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" allowfullscreen="" frameborder="0" height="600" width="800"> </div> </div> </figure></iframe></div></div></figure><h1 id="4e3b">Summary</h1><p id="1c48">Let’s summarize what we have learned using MDN.</p><figure id="7d4a"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*gGZJKGrxrIGDYu83tGYlwQ.png"><figcaption><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element">https://developer.mozilla.org/en-US/docs/Web/HTML/Element</a></figcaption></figure><p id="34e7">In this lesson, we learned many new <b>HTML tags</b> to help us add more <i>detailed</i> <b>structure</b> to our HTML code.</p><div id="994a"><pre><span class="hljs-type">HTML</span> tags => <span class="hljs-keyword">structure</span></pre></div><p id="3924">We learned how to use the <code><b>header</b></code> tag, the <code><b>main</b></code> tag, and the <code><b>footer</b></code> tag to add <b>sections</b> to our <code><b>body</b></code>.</p><div id="af74"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span><span class="hljs-section"></header></span> <span class="hljs-section"><main></span><span class="hljs-section"></main></span> <span class="hljs-section"><footer></span><span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="f58a">We also learned how to use the <code><b>nav</b></code> tag and the <code><b>section</b></code> tag to further divide and organize our sections into <b>subsections</b>.</p><div id="9890"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span><span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"><section></span><span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span><span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><p id="1522">When we’re ready to add <i>real content</i>, we learned how to use <code><b>h1</b></code> through <code><b>h6</b></code> tags, the <code><b>img</b></code> tag, the <code><b>p</b></code> tag, the <code><b>a</b></code> tag, and the <code><b>button</b></code> tag <i>to describe our content</i>.</p><div id="e13c"><pre><span class="hljs-section"><html></span> <span class="hljs-section"><head></span><span class="hljs-section"></head></span> <span class="hljs-section"><body></span> <span class="hljs-section"><header></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></header></span> <span class="hljs-section"><main></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h1></span><span class="hljs-section"></h1></span> <span class="hljs-section"><p></span><span class="hljs-section"></p></span> <span class="hljs-section"><button></span><span class="hljs-section"></button></span> <span class="hljs-section"><img /></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"><section></span> <span class="hljs-section"><h2></span><span class="hljs-section"></h2></span> <span class="hljs-section"></section></span> <span class="hljs-section"></main></span> <span class="hljs-section"><footer></span> <span class="hljs-section"><nav></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"><a></span><span class="hljs-section"></a></span> <span class="hljs-section"></nav></span> <span class="hljs-section"></footer></span> <span class="hljs-section"></body></span> <span class="hljs-section"></html></span></pre></div><blockquote id="d8ad"><p>Again, we will dive deeper into <b>content tags</b> in Lesson 16 and 17.</p></blockquote><p id="a805">When we take the time to use the <i>correct</i> HTML <b>tags</b> for their <i>intended</i> <i>purpose</i>, our HTML code becomes <b><i>semantic</i> </b>which greatly helps <b>screen readers</b> to understand our content and make it <b><i>accessible</i></b> to anyone with disability.</p><figure id="b460"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*51b81iC2MMJxj_cB1QK7LA.png"><figcaption><a href="https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML">https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML</a></figcaption></figure><p id="2417">In fact, <b>website</b> <b>accessibility</b> is now a <i>legal</i> <i>requirement</i> in many developed countries.</p><figure id="460f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*kTyzLXskKIqp1BISKQ2M_w.png"><figcaption><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG">https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG</a></figcaption></figure><p id="9e51">When our HTML code is <b><i>semantic</i></b>, it also helps <b>search engines</b> to <i>accurately</i> <i>index</i> our page which improves our ranking.</p><figure id="aa67"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*dcfejZEgOfiXnAi30LFWNQ.png"><figcaption><a href="https://developer.mozilla.org/en-US/docs/Glossary/SEO">https://developer.mozilla.org/en-US/docs/Glossary/SEO</a></figcaption></figure><p id="bd1c">This is known as <b>Search Engine Optimization</b> or <b>SEO</b>.</p><h1 id="487a">Concept Quiz</h1><p id="c1ed">Take my <a href="https://frontend.siliconwat.com/#learn-chapter6"><b>Programming Concept Quiz</b></a> to check your understanding! For every correct choice, you will earn <b>SW Coins</b> which you can redeem for <b><i>coupons</i></b> towards the purchase of any of my <a href="https://siliconwat.com">Udemy courses</a>!</p><figure id="9840"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*W9QdweXtoiKBtknlB_QEug.png"><figcaption><a href="https://quiz.siliconwat.com/?lang=en#frontend-chapter6">https://quiz.siliconwat.com/?lang=en#frontend-chapter6</a></figcaption></figure><p id="bac6"><b><i>Sample</i></b> Quiz Questions for <b>Lesson 6</b>:</p><h2 id="6b0b">Question 1:</h2><p id="69d5">What sectioning tag is found at the <b>top</b> of the page?</p><ol><li><code><header></header></code></li><li><code><main></main></code></li><li><code><footer></footer></code></li></ol><h2 id="9c67">Question 2:</h2><p id="c24d">What sectioning tag is found at the <b>middle</b> of the page?</p><ol><li><code><header></header></code></li><li><code><main></main></code></li><li><code><footer></footer></code></li></ol><h2 id="d15c">Question 3:</h2><p id="cf16">What sectioning tag is found at the <b>bottom</b> of the page?</p><ol><li><code><header></header></code></li><li><code><main></main></code></li><li><code><footer></footer></code></li></ol><h2 id="7b03">Question 4:</h2><p id="0011">The <code><b>header</b></code> tag is NOT the <i>first</i> child of <code><b>body</b></code>.</p><ol><li>True</li><li>False</li></ol><h2 id="cace">Question 5:</h2><p id="9426">The <code><b>main</b></code> tag is the <i>second</i> child of <code><b>body</b></code>.</p><ol><li>True</li><li>False</li></ol><h2 id="b75d">Question 6:</h2><p id="6fd1">The <code><b>footer</b></code> tag is NOT the <i>last</i> child of <code><b>body</b></code>.</p><ol><li>True</li><li>False</li></ol><h2 id="31b9">Question 7:</h2><p id="37e6">Which tag is NOT a <b>subsection</b> tag?</p><ol><li><code><nav></nav></code></li><li><code><section></section></code></li><li><code><p></p></code></li></ol><h2 id="5d96">Question 8:</h2><p id="7f3c">Which tag is NOT a <b>content</b> tag?</p><ol><li><code><p></p></code></li><li><code><a></a></code></li><li><code><button></button></code></li><li><code><section></section></code></li><li><code><img/></code></li></ol><h2 id="2f89">Question 9:</h2><p id="fc4a">Which is NOT a <b>heading</b> tag?</p><ol><li><code><b>h1</b></code></li><li><code><b>h3</b></code></li><li><code><b>h6</b></code></li><li><code><b>h7</b></code></li></ol><h2 id="09ab">Question 10:</h2><p id="8041">Which is NOT a benefit of <i>semantic</i> HTML code?</p><ol><li>Increased accessibility</li><li>Decreased search engine optimization</li><li>Increased code readability</li></ol><h2 id="9135">Question 11:</h2><p id="ce83">Website accessibility is a legal requirement.</p><ol><li>True</li><li>False</li></ol><figure id="6e36"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3gp3nMgg-X8wyMZvAgam8w.png"><figcaption><a href="https://quiz.siliconwat.com/?lang=en#frontend-chapter6">https://quiz.siliconwat.com/?lang=en#frontend-chapter6</a></figcaption></figure><p id="a4c4"><a href="https://frontend.siliconwat.com/#learn-chapter6">Programming Concept Quiz for Chapter 6</a></p><h1 id="a4d7">Coding Exercises</h1><p id="28d1">Check out my <a href="https://frontend.siliconwat.com/#practice-chapter6"><b>Interactive Coding Exercises</b></a> to put to practice what you have learned! There, you will also find <b><i>interactive hints</i></b> to help you understand<i> each line of code. </i>Likewise, for every correct solution, you will earn <b>SW Coins</b> which you can redeem for <b><i>coupons</i></b> towards the purchase of any of my <a href="https://siliconwat.com">Udemy courses</a>!</p><p id="b26c"><a href="https://frontend.siliconwat.com/#practice-chapter6">Interactive Coding Exercises for Chapter 6</a></p><h1 id="da70">Syntax Flashcards</h1><p id="ebac">Review what you have learned by playing my <a href="https://frontend.siliconwat.com/#review-chapter6"><b>Syntax Flashcard Game</b></a>! These flashcards are designed to help you <b><i>commit to memory</i></b> all the <b><i>new</i></b> <b>code</b> <b>syntaxes</b> you learned in this lesson.</p><figure id="4e79"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*6RMEQO5_h0AVm-9pXzIQDw.png"><figcaption><a href="https://flashcard.siliconwat.com/?lang=en#frontend-chapter6">https://flashcard.siliconwat.com/?lang=en#frontend-chapter6</a></figcaption></figure><p id="b583">Likewise, for every correct answer, you will earn <b>SW Coins</b> which you can redeem for <b><i>coupons</i></b> towards the purchase of any of my <a href="https://siliconwat.com">Udemy courses</a>!</p><figure id="d009"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*2KCyQSVXBQSzBZ1SgsHURQ.png"><figcaption><a href="https://flashcard.siliconwat.com/?lang=en#frontend-chapter6">https://flashcard.siliconwat.com/?lang=en#frontend-chapter6</a></figcaption></figure><p id="20ad"><a href="https://frontend.siliconwat.com/#review-chapter">Syntax Flashcard Game for Chapter 6</a></p><h1 id="ccc5">Next Steps</h1><p id="742a">Congrats on completing <b>Unit 2:</b> <b>Lesson 1 of 13</b>! 🎉</p><div id="9f05"><pre><span class="hljs-attribute">Unit</span> <span class="hljs-number">1</span>: <span class="hljs-number">100</span>% Completed <span class="hljs-attribute">Unit</span> <span class="hljs-number">2</span>: <span class="hljs-number">8</span>% Completed <span class="hljs-attribute">Unit</span> <span class="hljs-number">3</span>: <span class="hljs-number">0</span>% Completed <span class="hljs-attribute">Unit</span> <span class="hljs-number">4</span>: <span class="hljs-number">0</span>% Completed <span class="hljs-attribute">Unit</span> <span class="hljs-number">5</span>: <span class="hljs-number">0</span>% Completed <span class="hljs-attribute">Bonus</span> Unit <span class="hljs-number">6</span>: <span class="hljs-number">0</span>% Completed <span class="hljs-attribute">Bonus</span> Unit <span class="hljs-number">7</span>: <span class="hljs-number">0</span>% Completed</pre></div><div id="5403"><pre><span class="hljs-attribute">Overall</span> Progress: <span class="hljs-number">6</span>% Completed</pre></div><p id="6e7c"><a href="https://frontend.siliconwat.org">Join Remote Frontend Cohort Program</a></p><h2 id="c823">Next Lesson</h2><p id="6832">In the next lesson, we will learn how to <i>add</i> <b><i>dimensions</i></b> to our sectioning tags using <b>units</b> <b>of</b> <b>length</b>. There are <b><i>two</i></b> types of units: <b>absolute</b> and <b>relative</b>. Find out the <i>differences</i> <i>between them</i> and <i>some</i> <i>useful examples</i> in the next lesson!</p><p id="53ec"><b><a href="https://readmedium.com/chapter-7-units-of-length-838a4c4b1347">Chapter 7: CSS Units of Length</a></b></p><p id="f20a"><b><a href="https://frontend.siliconwat.com">Table of Contents</a></b></p><div id="f916" class="link-block"> <a href="https://medium.com/@thonly/membership"> <div> <div> <h2>Join Medium with my referral link — Thon Ly</h2> <div><h3>As a Medium member, a portion of your membership fee goes to writers you read, and you get full access to every story…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*gOmGdkmkAHn0xYBV)"></div> </div> </div> </a> </div><blockquote id="0a07"><p>When you use my <a href="https://medium.com/@thonly/membership">referral link</a> above 👆 to become a Medium member, <b>all proceeds</b> will be donated towards the construction of the <a href="https://siliconwat.org">Silicon Wat Campus</a> for children in <b>Ukraine</b> and <b>Cambodia</b> ❤️</p></blockquote></article></body>

Chapter 6: HTML Sectioning Tags

A Complete Frontend Developer Textbook for Beginners (2023 Edition)

This is the textbook version of Lesson 6 of 100 from the Udemy video course: A Complete Frontend Developer Course for Beginners

Chapter 5: Importing JavaScript CodeTable of Contents

Overview

This lesson covers the following HTML tags, CSS properties, and JavaScript commands for the first time:

HTML

  1. header
  2. main
  3. footer
  4. section
  5. nav
  6. heading (h1 to h6)
  7. a
  8. img
  9. button

CSS

None.

JS

None.

This lesson begins with a fresh Codepen. Open a new one and code along with me to increase retention!

Lecture

In this lesson, we examine how to properly layout a page. Let’s use Flat’s homepage as a model for reference:

https://flat.io

The best practice is for every page to have a header section at the very top where the logo and menu reside.

header section: logo + menu

At the very bottom is the footer section where the sitemap and copyright reside.

https://flat.io
footer section: sitemap + copyright

In between is the main section where the main content resides.

main section: content

Sectioning Tags

In our HTML code, we can easily model this.

<html>
   <head></head>
   <body></body>
</html>

Inside the body, we can write header as the first child:

<html>
   <head></head>
   <body>
      <header></header>
   </body>
</html>

main as the second child:

<html>
   <head></head>
   <body>
      <header></header>
      <main></main>
   </body>
</html>

And footer as the last child:

<html>
   <head></head>
   <body>
      <header></header>
      <main></main>
      <footer></footer>
   </body>
</html>

When we clearly section the content in our body in this way, screen readers are able to easily understand our page and properly communicate it to any users with disability.

Screen Readers => Sectioning Tags

Also, this makes it easier for search engines like Google to accurately index our page which helps us to attract the right users to our site.

Search Engines => Sectioning Tags

The finished Codepen:

Subsectioning Tags

To make it even more search engine friendly and screen reader friendly, it’s recommended that we also further organize our sections into subsections.

sections => subsections

Referencing Flat as an example, inside the header section, we can group the menu inside a navigation tag:

https://flat.io
header: menu => navigation subsection = <nav></nav>

We could also use this navigation tag to group the sitemap in the footer section:

https://flat.io
footer: sitemap => navigation subsection = <nav></nav>

As for the main section, we can clearly see multiple subsections:

https://flat.io

Therefore, we can simply use a generic section tag for each one.

main: subsections => section subsections = <section></section>

In HTML code, we can also easily model this.

<html>
   <head></head>
   <body>
      <header></header>
      <main></main>
      <footer></footer>
   </body>
</html>

Inside header, we can add a nav tag for the menu:

<html>
   <head></head>
   <body>
      <header>
         <nav></nav>
      </header>
      <main></main>
      <footer></footer>
   </body>
</html>

Inside footer, we can also add a nav tag for the sitemap:

<html>
   <head></head>
   <body>
      <header>
         <nav></nav>
      </header>
      <main></main>
      <footer>
         <nav></nav>
      </footer>
   </body>
</html>

Inside main, we can add as many section tags as necessary:

<html>
   <head></head>
   <body>
      <header>
         <nav></nav>
      </header>
      <main>
         <section></section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav></nav>
      </footer>
   </body>
</html>

Again, when we organize our content into sections and subsections using descriptive tag names, we make it easy for search engines and screen readers to understand our page.

Search Engines => sections + subsections
Screen Readers => sections + subsections

Furthermore, team members appreciate it too because our HTML code is more organized and easier to read.

Team Members => sections + subsections

The finished Codepen:

Content Tags

We have learned how to use sectioning tags and subsectioning tags to organize and describe our page.

HTML document: sections + subsections

For our texts and images, we should also use the right kinds of tags to describe them.

texts + images => content tags

These kinds of tags are known as content tags because they contain actual content (e.g., text nodes and image data) as their children.

For example, there are six types of heading tags numbered 1 through 6:

Heading 1 = <h1></h1>
Heading 2 = <h2></h2>
Heading 3 = <h3></h3>
Heading 4 = <h4></h4>
Heading 5 = <h5></h5>
Heading 6 = <h6></h6>

Heading 1 should be used for the highest heading levels while heading 6 should be used for the lowest heading levels.

Heading 1 => Highest
Heading 6 => Lowest

Referencing Flat for instance, this could be heading 1:

https://flat.io

While this could be heading 2:

https://flat.io

And this could also be heading 2:

https://flat.io

We could use a paragraph tag for this description:

https://flat.io
paragraph tag = <p></p>

A button tag for this button:

https://flat.io
button tag = <button></button>

And an image tag for this image:

https://prod-site.flat-cdn.com/img/f42b25c.webp
image tag = <img />

We could use anchor tags for these links in the header:

And these links in the footer:

https://flat.io
anchor tag = <a></a>

In the HTML code, we can also easily model this:

<html>
   <head></head>
   <body>
      <header>
         <nav></nav>
      </header>
      <main>
         <section></section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav></nav>
      </footer>
   </body>
</html>

Inside nav in the header, we can add as many anchor tags as necessary for the menu:

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section></section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav></nav>
      </footer>
   </body>
</html>

Anchor is shortened to just a because it’s used very often.

Remember, the shorter the tag names, the more popular they are!

We could also add as many anchor tags as necessary for the sitemap inside the nav in the footer:

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section></section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </footer>
   </body>
</html>

Inside the first subsection of main, we can add a heading 1 tag:

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section>
            <h1></h1>
         </section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </footer>
   </body>
</html>

Inside the second and third subsections, we can add heading 2 tags:

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section>
            <h1></h1>
         </section>
         <section>
            <h2></h2>
         </section>
         <section>
            <h2></h2>
         </section>
      </main>
      <footer>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </footer>
   </body>
</html>

Again, heading is shortened to just h because it’s used very often.

Inside the first subsection, we can add a p tag for the paragraph description, a button tag for the button, and an img tag for the image:

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section>
            <h1></h1>
            <p></p>
            <button></button>
            <img />
         </section>
         <section>
            <h2></h2>
         </section>
         <section>
            <h2></h2>
         </section>
      </main>
      <footer>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </footer>
   </body>
</html>

Again, these kinds of tags are called content tags because they contain actual content.

content tags => actual content

When we use the right kind that describes its content, we will further make our page search engine friendly and screen reader friendly.

In Lesson 16 and 17, we will dive much deeper into content tags!

The finished Codepen:

Summary

Let’s summarize what we have learned using MDN.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element

In this lesson, we learned many new HTML tags to help us add more detailed structure to our HTML code.

HTML tags => structure

We learned how to use the header tag, the main tag, and the footer tag to add sections to our body.

<html>
   <head></head>
   <body>
      <header></header>
      <main></main>
      <footer></footer>
   </body>
</html>

We also learned how to use the nav tag and the section tag to further divide and organize our sections into subsections.

<html>
   <head></head>
   <body>
      <header>
         <nav></nav>
      </header>
      <main>
         <section></section>
         <section></section>
         <section></section>
      </main>
      <footer>
         <nav></nav>
      </footer>
   </body>
</html>

When we’re ready to add real content, we learned how to use h1 through h6 tags, the img tag, the p tag, the a tag, and the button tag to describe our content.

<html>
   <head></head>
   <body>
      <header>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </header>
      <main>
         <section>
            <h1></h1>
            <p></p>
            <button></button>
            <img />
         </section>
         <section>
            <h2></h2>
         </section>
         <section>
            <h2></h2>
         </section>
      </main>
      <footer>
         <nav>
            <a></a>
            <a></a>
         </nav>
      </footer>
   </body>
</html>

Again, we will dive deeper into content tags in Lesson 16 and 17.

When we take the time to use the correct HTML tags for their intended purpose, our HTML code becomes semantic which greatly helps screen readers to understand our content and make it accessible to anyone with disability.

https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML

In fact, website accessibility is now a legal requirement in many developed countries.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG

When our HTML code is semantic, it also helps search engines to accurately index our page which improves our ranking.

https://developer.mozilla.org/en-US/docs/Glossary/SEO

This is known as Search Engine Optimization or SEO.

Concept Quiz

Take my Programming Concept Quiz to check your understanding! For every correct choice, you will earn SW Coins which you can redeem for coupons towards the purchase of any of my Udemy courses!

https://quiz.siliconwat.com/?lang=en#frontend-chapter6

Sample Quiz Questions for Lesson 6:

Question 1:

What sectioning tag is found at the top of the page?

  1. <header></header>
  2. <main></main>
  3. <footer></footer>

Question 2:

What sectioning tag is found at the middle of the page?

  1. <header></header>
  2. <main></main>
  3. <footer></footer>

Question 3:

What sectioning tag is found at the bottom of the page?

  1. <header></header>
  2. <main></main>
  3. <footer></footer>

Question 4:

The header tag is NOT the first child of body.

  1. True
  2. False

Question 5:

The main tag is the second child of body.

  1. True
  2. False

Question 6:

The footer tag is NOT the last child of body.

  1. True
  2. False

Question 7:

Which tag is NOT a subsection tag?

  1. <nav></nav>
  2. <section></section>
  3. <p></p>

Question 8:

Which tag is NOT a content tag?

  1. <p></p>
  2. <a></a>
  3. <button></button>
  4. <section></section>
  5. <img/>

Question 9:

Which is NOT a heading tag?

  1. h1
  2. h3
  3. h6
  4. h7

Question 10:

Which is NOT a benefit of semantic HTML code?

  1. Increased accessibility
  2. Decreased search engine optimization
  3. Increased code readability

Question 11:

Website accessibility is a legal requirement.

  1. True
  2. False
https://quiz.siliconwat.com/?lang=en#frontend-chapter6

Programming Concept Quiz for Chapter 6

Coding Exercises

Check out my Interactive Coding Exercises to put to practice what you have learned! There, you will also find interactive hints to help you understand each line of code. Likewise, for every correct solution, you will earn SW Coins which you can redeem for coupons towards the purchase of any of my Udemy courses!

Interactive Coding Exercises for Chapter 6

Syntax Flashcards

Review what you have learned by playing my Syntax Flashcard Game! These flashcards are designed to help you commit to memory all the new code syntaxes you learned in this lesson.

https://flashcard.siliconwat.com/?lang=en#frontend-chapter6

Likewise, for every correct answer, you will earn SW Coins which you can redeem for coupons towards the purchase of any of my Udemy courses!

https://flashcard.siliconwat.com/?lang=en#frontend-chapter6

Syntax Flashcard Game for Chapter 6

Next Steps

Congrats on completing Unit 2: Lesson 1 of 13! 🎉

Unit 1: 100% Completed
Unit 2: 8% Completed
Unit 3: 0% Completed
Unit 4: 0% Completed
Unit 5: 0% Completed
Bonus Unit 6: 0% Completed
Bonus Unit 7: 0% Completed
Overall Progress: 6% Completed

Join Remote Frontend Cohort Program

Next Lesson

In the next lesson, we will learn how to add dimensions to our sectioning tags using units of length. There are two types of units: absolute and relative. Find out the differences between them and some useful examples in the next lesson!

Chapter 7: CSS Units of Length

Table of Contents

When you use my referral link above 👆 to become a Medium member, all proceeds will be donated towards the construction of the Silicon Wat Campus for children in Ukraine and Cambodia ❤️

HTML
CSS
JavaScript
Front End Development
Programming
Recommended from ReadMedium