<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Murtuzaali Surti - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Murtuzaali Surti - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 08 May 2026 16:49:25 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/murtuza/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Less Common HTML Tags You Should Know – With Example Code ]]>
                </title>
                <description>
                    <![CDATA[ There are only so many HTML tags that people typically use when building websites.  But as there are over 100+ HTML elements, I wondered if there were any more beginner-friendly tags that I didn't know about – and that others might find useful, too. ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/less-common-html-tags/</link>
                <guid isPermaLink="false">66d034dd2b211a17e00e36c1</guid>
                
                    <category>
                        <![CDATA[ HTML ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Murtuzaali Surti ]]>
                </dc:creator>
                <pubDate>Mon, 29 Jan 2024 14:00:55 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/01/Exotic-HTML-TAGS-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>There are <a target="_blank" href="https://css-tricks.com/average-web-page-data-analyzing-8-million-websites/">only so many HTML tags</a> that people typically use when building websites. </p>
<p>But as there are over 100+ HTML elements, I wondered if there were any more beginner-friendly tags that I didn't know about – and that others might find useful, too. </p>
<p>After doing some research, I came up with this collection of some less well-known, but still very useful, HTML tags.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/html-for-babies-imgur.png" alt="a baby reading a book named &quot;HTML for Babies&quot;" width="600" height="400" loading="lazy">
<em>Source: imgur</em></p>
<h2 id="heading-1-the-element">1. The <code>&lt;base&gt;</code> element</h2>
<p>When you set the <code>href</code> attribute on an <code>a</code> tag to a relative URL, the default base URL it considers is the <code>location.href</code> URL. </p>
<p>You can override this behavior by defining this tag above all HTML elements which deal with relative URLs.</p>
<p>For example, if I do this:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">base</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://syntackle.live"</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/contact/"</span>&gt;</span>Contact<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
</code></pre>
<p>then, the href URL for the <code>a</code> tag will be <code>https://syntackle.live/contact/</code>.</p>
<p>Keep in mind that there can be only one <code>&lt;base&gt;</code> tag per page. If you define multiple <code>&lt;base&gt;</code> tags, then only the first tag will be considered.</p>
<p>You won't need this element most of the time, but if you feel like all of the URLs on a page point to another site, then declaring it is beneficial.</p>
<h2 id="heading-2-the-element">2. The <code>&lt;aside&gt;</code> element</h2>
<p>You can use this element for any content not directly related to the main content of the page. It works well for displaying advertisements, related posts, promotional content, blockquotes, nav elements, and so on.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Post<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This post is about a breed of dogs.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">aside</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Learn more about cats.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">aside</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span>
</code></pre>
<p>For example, in the above snippet, the post is mainly about dogs and their breeds. But if you wrote an article about cats and you wanted to link to it from the dog article, then you could use the <code>aside</code> element to mention it. The content in the <code>aside</code> element can be tangentially related to the page.</p>
<p>The HTML specification provides <a target="_blank" href="https://html.spec.whatwg.org/multipage/sections.html#the-aside-element">some good examples on how to use the <code>&lt;aside&gt;</code> element</a>.</p>
<h2 id="heading-3-the-element">3. The <code>&lt;search&gt;</code> element</h2>
<p>You can use the <code>&lt;search&gt;</code> element as a container for elements dealing with search or filtering. For example, a form sending a POST request to get search results or a search component relying on JavaScript for filtering.</p>
<pre><code class="lang-html">// search component relying on JavaScript
<span class="hljs-tag">&lt;<span class="hljs-name">search</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"searchInput"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"results"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">search</span>&gt;</span>
</code></pre>
<p>Here's another example:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">search</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"search.js"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"POST"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"searchInput"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Search<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">search</span>&gt;</span>
</code></pre>
<p>In both of the above examples, the elements wrapped within the <code>search</code> element play a role in the search functionality of a site. </p>
<p>You should use this element because it provides semantic value to the browser and accessibility tools such as screen readers.</p>
<h2 id="heading-4-the-element">4. The <code>&lt;q&gt;</code> element</h2>
<p>Most people just use quotation marks <code>(")</code> to quote something. But there is a dedicated HTML tag just for this. Using it, you can quote something from another source and by defining its <code>cite</code> attribute, you can also link to that source.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">q</span> <span class="hljs-attr">cite</span>=<span class="hljs-string">"https://another-source.com"</span>&gt;</span>This is a quote from another source.<span class="hljs-tag">&lt;/<span class="hljs-name">q</span>&gt;</span>
</code></pre>
<p>However, according to the HTML spec:</p>
<blockquote>
<p>The use of q elements to mark up quotations is entirely optional; using explicit quotation punctuation without q elements is just as correct. - <a target="_blank" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element">html.spec.whatwg.org</a></p>
</blockquote>
<h2 id="heading-5-the-element">5. The <code>&lt;var&gt;</code> element</h2>
<p>If you are dealing with math in your webpage, explaining a concept, or solving a problem, then this element can come in handy when mentioning variables while describing the problem.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>These are three variables, <span class="hljs-tag">&lt;<span class="hljs-name">var</span>&gt;</span>a<span class="hljs-tag">&lt;/<span class="hljs-name">var</span>&gt;</span>, <span class="hljs-tag">&lt;<span class="hljs-name">var</span>&gt;</span>b<span class="hljs-tag">&lt;/<span class="hljs-name">var</span>&gt;</span> and <span class="hljs-tag">&lt;<span class="hljs-name">var</span>&gt;</span>c<span class="hljs-tag">&lt;/<span class="hljs-name">var</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">sup</span>&gt;</span>2<span class="hljs-tag">&lt;/<span class="hljs-name">sup</span>&gt;</span>.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/01/varElement.PNG" alt="varElement" width="600" height="400" loading="lazy"></p>
<p>You can use this element to show a visual representation of known or unknown variables, as shown above.</p>
<h2 id="heading-6-the-element">6. The <code>&lt;samp&gt;</code> element</h2>
<p>This element depicts the output from another software or computer system. There's also a <a target="_blank" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-kbd-element"><code>kbd</code></a> element (used for displaying user inputs) which is visually similar to this element.</p>
<p>You can use this element to display the output of the console or the output of a computer program.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">pre</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">code</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"language-javascript"</span>&gt;</span>console.log(1 + 2)<span class="hljs-tag">&lt;/<span class="hljs-name">code</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">samp</span>&gt;</span>3<span class="hljs-tag">&lt;<span class="hljs-name">samp</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">pre</span>&gt;</span>
</code></pre>
<h2 id="heading-7-the-element">7. The <code>&lt;datalist&gt;</code> element</h2>
<p>You might be familiar with the <code>select</code> element that lets you provide users with a bunch of options to select from. A similar element is the <code>datalist</code> element.</p>
<p>The only difference between them is the datalist element provides suggestions instead of a finite set of options. Users can also type in their own input if none of the suggestions match their requirements, whereas when using the select element, users must pick from the list of options in the dropdown.</p>
<p>You can use <code>&lt;datalist&gt;</code> with the <code>input</code> element so the user can type anything they want. Then if it matches the values in the datalist, the user can select that value. </p>
<p>In order to link the input element with the datalist, you'll need to use a <code>list</code> attribute on the input element. The value of the list attribute must be the <code>id</code> of the datalist.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span>
    Cars:
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">car</span> <span class="hljs-attr">list</span>=<span class="hljs-string">"cars"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">datalist</span> <span class="hljs-attr">id</span>=<span class="hljs-string">cars</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">option</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Ferrari"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">option</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Mercedes"</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">datalist</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
</code></pre>
<p>It supports different types of inputs but it comes with <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist#browser_compatibility">partial browser support</a>.</p>
<h2 id="heading-8-the-element">8. The <code>&lt;progress&gt;</code> element</h2>
<p>The native progress element in HTML, as the name suggests, is used to track the progress of a task. </p>
<p>You can use this element in two ways: determinately or indeterminately. A determinate progress bar knows where it currently is, and if the max value is specified, you can also figure out how much more is left.</p>
<p>To create a determinate progress bar, you need to specify the value attribute. The default range of the value is from <code>0.0</code> to <code>1.0</code>. But you can also specify a custom <code>max</code> value which has to be a valid floating point number.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">progress</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"0"</span>&gt;</span>0%<span class="hljs-tag">&lt;/<span class="hljs-name">progress</span>&gt;</span>
<span class="hljs-comment">&lt;!-- or --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">progress</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"0"</span> <span class="hljs-attr">max</span>=<span class="hljs-string">"100"</span>&gt;</span>0%<span class="hljs-tag">&lt;/<span class="hljs-name">progress</span>&gt;</span>
</code></pre>
<p>To increment/decrement the value of the progress bar, set the value attribute to the desired number. Here's a dummy implementation of progress update:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">progress</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"0"</span> <span class="hljs-attr">max</span>=<span class="hljs-string">"100"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">progress</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
    <span class="hljs-keyword">const</span> progressBar = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"progress"</span>)

    <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
        <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
            progressBar.value = <span class="hljs-number">100</span>
        }, <span class="hljs-number">300</span>)
        progressBar.value = <span class="hljs-number">65</span>
    }, <span class="hljs-number">500</span>)

    progressBar.value = <span class="hljs-number">10</span>
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>To display an indeterminate progress bar, you should not include the <code>value</code> attribute in the <code>&lt;progress&gt;</code> element. Indeterminate progress bars are useful when you can't precisely tell how much time the user will have to wait for something to load.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">progress</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"indeterminate-progress-bar"</span>&gt;</span>Indeterminate<span class="hljs-tag">&lt;/<span class="hljs-name">progress</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/01/chrome_KPPOfkrwA4.gif" alt="chrome_KPPOfkrwA4" width="600" height="400" loading="lazy"></p>
<h2 id="heading-9-the-element">9. The <code>&lt;dialog&gt;</code> element</h2>
<p>I consider this the most useful element nowadays because it saves you from the hassle of creating your own modal with z-index workarounds. But that doesn't mean you should <a target="_blank" href="https://www.scottohara.me/blog/2023/01/26/use-the-dialog-element.html">overuse</a> it. You can use it to create modal/non-modal interactive dialogs in order to alert users or show a one-time message.</p>
<p>For example, if you want to show a one-time message to users visiting your site, then you can wrap a <code>form</code> element in a <code>dialog</code> and then mention "dialog" as the form method. Clicking on the button inside the form will close the dialog. </p>
<p>This is a type of non-modal dialog and it doesn't require JavaScript. The <code>open</code> attribute tells you that the dialog will be shown as soon as the page loads.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">dialog</span> <span class="hljs-attr">open</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is a one time message. Click the button to close it.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"dialog"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Ok<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dialog</span>&gt;</span>
</code></pre>
<p>To create a modal dialog, you need a bit of JavaScript to handle click events to show and hide the modal. There are two methods — <code>showModal()</code> and <code>close()</code> – which you can use on the dialog element after accessing it with JavaScript.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">dialog</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is a dialog box.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"close"</span>&gt;</span>Close<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dialog</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open"</span>&gt;</span>Open Dialog Box<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
    <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#open"</span>).addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
        <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"dialog"</span>).showModal()
    })

    <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#close"</span>).addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
        <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"dialog"</span>).close()
    })
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>There's <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#examples">so much you can do</a> with the <code>dialog</code> element but it's only good for certain <a target="_blank" href="https://www.nngroup.com/articles/modal-nonmodal-dialog/">use cases</a> such as presenting the user a sign up form which is closable, displaying a warning before the user performs a critical action, and so on.</p>
<p>One situation where you shouldn't use them is during the checkout process of an ecommerce application. This is because the user is performing something critical, and if they accidentally close the dialog, then it creates disruption in user flow and experience.</p>
<h2 id="heading-semantic-html">Semantic HTML</h2>
<p>The elements mentioned above fall under an umbrella term: <a target="_blank" href="https://www.a11yproject.com/posts/what-is-semantic-html/">Semantic HTML</a>. Semantic HTML gives meaning to your HTML content – not only to users but to browsers, crawlers, and accessibility tools as well.</p>
<p>Not everyone can see the screen or use devices such as a mouse to navigate the web. Instead, they rely on assistive technologies which help them interpret the content. </p>
<p>Also, search engines can find relevant content more easily by traversing through semantic HTML. That's why it should be one of your top priorities when you're building a website.</p>
<p>You also don't want your website to be <a target="_blank" href="https://www.scottohara.me/blog/2022/01/20/divisive.html">just a bunch of divs</a> because a <code>div</code> element doesn't mean anything to a browser in terms of content — for a browser, it's just a division element to separate content.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/divs-1.png" alt="a bunch of div elements" width="600" height="400" loading="lazy">
<em>a bunch of div elements (Source: imgur)</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Today, you learned about some HTML elements or tags which you probably didn't know about earlier. </p>
<p>There's a specific purpose for each HTML element and you should wrap your content within the appropriate elements. </p>
<p>You also learned about semantic HTML and that it's the best way to give meaning and structure to your content.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
