+ 1

Plz explain me what is the difference between inline and block element:-

18th Dec 2021, 9:44 AM
Jishnu Kundu
Jishnu Kundu - avatar
3 Réponses
+ 5
Block-level Elements A block-level element always starts on a new line. A block-level element always takes up the full width available (stretches out to the left and right as far as it can). A block level element has a top and a bottom margin, whereas an inline element does not. The <div> element is a block-level element. Inline Elements An inline element does not start on a new line. An inline element only takes up as much width as necessary. This is a <span> element inside a paragraph. <span>Hello World</span> <!-- Keep learning & happy coding :D --> https://www.w3schools.com/html/html_blocks.asp
18th Dec 2021, 10:16 AM
SoloProg
SoloProg - avatar
+ 5
Ananya is wrong p is block-level element, and this is not about starting tag, some inline as span have both tag opening and closening tag. As SoloProg said read this https://www.w3schools.com/html/html_blocks.asp and you will see diference and list of every element what are block/inline Common inline tag, what you can see in neer every site are: img,a,br, every tag for editing text (bold,italic....),button, input, span. inline react diferent when you try to add margin.
18th Dec 2021, 10:23 AM
PanicS
PanicS - avatar
+ 3
This question seems to come up frequently? It's probably best you also test block/inline yourself on some elements to see the difference. Here's a demo code: https://code.sololearn.com/WiYwYJHtnJRp/?ref=app
18th Dec 2021, 10:22 AM
Lisa
Lisa - avatar