Please explain me display in css. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please explain me display in css.

Thanks ☺

17th Nov 2016, 9:34 PM
EL KHARRACHI KHAYYA
EL KHARRACHI KHAYYA - avatar
4 Answers
+ 2
Nice explanation by arthur, but there is a LOT more than three values! The most important one, display: inline-block; an inline element that has width and height like a block element, best of both worlds really And my favourite.. display: flex/inline-flex; people have realized that all those display values are confusing and messy when trying to do complicated layouts, so they made flex to rule them all. Long topic though... Check it out some time, once you run into problems with just block/inline/inline-block :) Here's a full list of all the display values: https://developer.mozilla.org/en/docs/Web/CSS/display
17th Nov 2016, 10:21 PM
Schindlabua
Schindlabua - avatar
+ 1
The 'display' property in CSS is a key part of your element's layout. There are three values you can assign to the property: block: this will display the element on a new line and the element will stretch horizontally (left and right) as far as it can. Some tags that are displayed in blocks by default: div, p, h1, h2, h3, ... inline: this will display the element on the same line as the previous element. This is often used on 'li' tags to display lists horizontally (left to right) instead of vertically (top to bottom). Some tags that are displayed inline by default: span, a, img, ... none: this will simply not display the element. The layout of other elements will be as if the first element is not on the page.
17th Nov 2016, 9:46 PM
Arthur Busser
Arthur Busser - avatar
0
thank you Arthur Busser 👍
17th Nov 2016, 9:50 PM
EL KHARRACHI KHAYYA
EL KHARRACHI KHAYYA - avatar
0
thank you Schindlabua
18th Nov 2016, 12:28 AM
EL KHARRACHI KHAYYA
EL KHARRACHI KHAYYA - avatar