Display property | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Display property

When i type Div { display: inline; } It doesn’t apply to the html. However when if i change it so the property’s applied to the p it works P { display: inline; } Can somebody explain why? I don’t want to have to type the class for every para that needs to be displayed as an inline element.

7th Aug 2018, 2:57 PM
Helen
Helen - avatar
4 Answers
+ 2
for the div you should use inline-block
7th Aug 2018, 3:35 PM
TrueJu
TrueJu - avatar
+ 2
it is but a div has to have display:inline-block; while other elements can use inline and inline-block
7th Aug 2018, 3:39 PM
TrueJu
TrueJu - avatar
+ 1
so the display property is not applicable for div?
7th Aug 2018, 3:38 PM
Helen
Helen - avatar
+ 1
oh i see. thank you so much 👍🏽
7th Aug 2018, 4:09 PM
Helen
Helen - avatar