Can you describe the difference between inline elements and block elements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you describe the difference between inline elements and block elements?

Html

23rd Jan 2021, 6:18 AM
Jahnavi Manchi
Jahnavi Manchi - avatar
3 Answers
+ 8
In HTML, most elements are defined as block level or inline elements. Block level elements start from a new line. For example: <h1>, <form>, <li>, <ol>, <ul>, <p>, <pre>, <table>, <div>, etc. Inline elements are normally displayed without line breaks. For example: <b>, <a>, <strong>, <img>, <input>, <em>, <span>, etc. The <div> element is a block-level element that is often used as a container for other HTML elements. When used together with some CSS styling, the <div> element can be used to style blocks of content
23rd Jan 2021, 6:37 AM
K.S.S. Karunarathne
K.S.S. Karunarathne - avatar
+ 1
Tnq so much
23rd Jan 2021, 6:38 AM
Jahnavi Manchi
Jahnavi Manchi - avatar
0
There are two display values: block and inline. 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. Inline Elements An inline element does not start on a new line. An inline element only takes up as much width as necessary.
30th Mar 2021, 3:33 PM
Anurag Kumar
Anurag Kumar - avatar