<?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" version="2.0"><channel><title><![CDATA[HTML Block and Inline Elements]]></title><description><![CDATA[HTML Block and Inline Elements]]></description><link>https://html-block-and-inline-elements.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 21:30:01 GMT</lastBuildDate><atom:link href="https://html-block-and-inline-elements.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[HTML Block and Inline Elements]]></title><description><![CDATA[if you ever notice in HTML some tags take full width space but some take they required, this is because of inline element and block level element
Now your question will be what is inline element and block level element ?
INLINE ELEMENTS
inline elemen...]]></description><link>https://html-block-and-inline-elements.hashnode.dev/html-block-and-inline-elements</link><guid isPermaLink="true">https://html-block-and-inline-elements.hashnode.dev/html-block-and-inline-elements</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[#HiteshChaudhary ]]></category><dc:creator><![CDATA[Prem Takawane]]></dc:creator><pubDate>Wed, 22 Jan 2025 22:16:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1737580780111/8d5dcd3b-d5c6-48fd-b4a1-bf6e1640b663.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>if you ever notice in HTML some tags take full width space but some take they required, this is because of inline element and block level element</p>
<p>Now your question will be what is inline element and block level element ?</p>
<h1 id="heading-inline-elements">INLINE ELEMENTS</h1>
<p>inline elements are HTML tag which take only space which they required .</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</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">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">"https://www.google.com"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"background-color: red"</span>&gt;</span>I AM LINK TAG (a tag)<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>button<span class="hljs-tag">&lt;/<span class="hljs-name">button</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">html</span>&gt;</span>
</code></pre>
<p>in this example a and button will be in same line as they inline elements and they will only consume only space they required</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737582000428/8653c99e-6424-428a-8e84-0cb3e4596297.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-but-block-level-elements-are-totally-opposite-of-this">BUT BLOCK LEVEL ELEMENTS ARE TOTALLY OPPOSITE OF THIS ..!</h3>
<h2 id="heading-here-are-the-inline-elements-in-html">Here are the Inline elements in HTML:</h2>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">&lt;a&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">&lt;b</a><a target="_blank" href="https://www.w3schools.com/tags/tag_acronym.asp">r</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">\&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">&lt;</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">bu</a><a target="_blank" href="https://www.w3schools.com/tags/tag_b.asp">t</a><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">ton</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">\&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">&lt;i</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">mg</a><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">\&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">&lt;inp</a><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">ut&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_acronym.asp">&lt;su</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">p</a><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">\&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">&lt;t</a><a target="_blank" href="https://www.w3schools.com/tags/tag_acronym.asp">e</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">x</a><a target="_blank" href="https://www.w3schools.com/tags/tag_a.asp">tar</a><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">ea</a><a target="_blank" href="https://www.w3schools.com/tags/tag_b.asp">\&gt;</a></p>
<h1 id="heading-block-lhttpswwww3schoolscomtagstagabbraspevehttpswwww3schoolscomtagstagbaspl-ehttpswwww3schoolscomtagstagacronymasplemhttpswwww3schoolscomtagstagbaspenhttpswwww3schoolscomtagstagacronymasptshttpswwww3schoolscomtagstagbdoasp"><a target="_blank" href="https://www.w3schools.com/tags/tag_abbr.asp">BLOCK L</a><a target="_blank" href="https://www.w3schools.com/tags/tag_b.asp">EVE</a><a target="_blank" href="https://www.w3schools.com/tags/tag_acronym.asp">L E</a><a target="_blank" href="https://www.w3schools.com/tags/tag_b.asp">LEM</a><a target="_blank" href="https://www.w3schools.com/tags/tag_acronym.asp">EN</a><a target="_blank" href="https://www.w3schools.com/tags/tag_bdo.asp">TS</a></h1>
<p>as now got idea, Block level elements mean HTML tag which take full width of space</p>
<p>in this image H1 tag take full with of space</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</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">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">h1</span>&gt;</span>Hi, Welcome<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Hi, Welcome<span class="hljs-tag">&lt;/<span class="hljs-name">h2</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">html</span>&gt;</span>
</code></pre>
<p>THEN OUT-PUT WILL BE</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737582679145/5623f991-1790-4b33-876d-42ac137c011b.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-here-are-the-block-level-elements-in-html">Here are the block-level elements in HTML:</h2>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">&lt;div&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">&lt;h</a><a target="_blank" href="https://www.w3schools.com/tags/tag_dl.asp">1&gt;-&lt;</a><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">h6&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_dl.asp">&lt;he</a><a target="_blank" href="https://www.w3schools.com/tags/tag_dt.asp">ade</a><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">r&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_dl.asp">&lt;hr&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">&lt;li&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_dl.asp">&lt;o</a><a target="_blank" href="https://www.w3schools.com/tags/tag_dt.asp">l&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">&lt;p&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/tags/tag_div.asp">&lt;</a><a target="_blank" href="https://www.w3schools.com/tags/tag_dl.asp">ul&gt;</a></p>
<p><a target="_blank" href="https://www.w3schools.com/html/html_blocks.asp">KNOW MORE</a></p>
<p>NOW QUESTION IS THIS INLINE ELEMENT CAN BE BECOME BLOCK LEVEL ELEMENTS</p>
<p>ANSWER : YES, WE CAN</p>
<p>Now if you want to convert block level elements EX- H1 to inline elements</p>
<p>you just have to type DISPLAY : INLINE</p>
<p>and boom just magin happen</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"display: inline;"</span>&gt;</span>Massage<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p>and you can also make inline elements into block level elements</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"display: block;"</span>&gt;</span>Massage<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
]]></content:encoded></item></channel></rss>