Inline vs block elements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Inline vs block elements

Does inline mean within opening and closing of 1 tag? and block means it is having multiple elements within it?

19th Aug 2018, 7:10 PM
Lax
3 Answers
+ 3
Example for inline👇 <h1>Text<u>Underlined</u></h1> Here <u> is inline because it adding styles or reference to a text without starting a new line in the page. Just think about , • <i> - makes text italic • <a> - makes text as link • <font> - make text styles This elements are works as inline in a code... Example for block👇 <h1></h1> <p>Paragraph </p> Here <p> element starting in a new line after <h1> element.. (Right??).So <p> element is block level.. Also <h1> is a block level. Think about , • <h2> - heading • <hr> - horizontal line • <div> - section blocks
20th Aug 2018, 2:52 AM
Joshua Raison
Joshua Raison - avatar
+ 1
No. Block elem occupy all line and start from a new line An inline element does not start on a new line and only takes up as much width as necessary. https://www.w3schools.com/html/html_blocks.asp
19th Aug 2018, 7:46 PM
The Ophiuchus
The Ophiuchus - avatar
+ 1
Thank you both, really appreciate your responses, I understand now
20th Aug 2018, 8:18 PM
Lax