Help. i dont quite get it. Explain me with examples. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help. i dont quite get it. Explain me with examples.

inline and block elements. and what is the difference between them

5th Dec 2016, 5:40 PM
stephen haokip
stephen haokip - avatar
1 Answer
+ 1
A block element takes up the full width of its parent. A div is by default a block element. If you had some parent node with a width of 200 px and you out a block element inside that parent node the child element would fill that entire available width of its parent. An inline element takes up only as much width as it needs to to hold its own content. If you had some inline element with 10 px of content inside it and you put it in the previously mentioned parent node, the inline element would still only take up 10 px of the available 200 px. Block elements can also be styled with passing and margin which inline elements can not. These are just the basic differences.
5th Dec 2016, 11:02 PM
James Durand
James Durand - avatar