How to place block element inside of an inline element with display:block css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to place block element inside of an inline element with display:block css?

Is there a way to place block elements inside of an inline element with display:block css?

26th Jan 2017, 8:17 AM
Maxim Velichkin
Maxim Velichkin - avatar
4 Answers
+ 1
You mean: <span style="display:block;"><div>some content</div></span> ? Yes, but it's strictly identiqual to: <div><div>some content</div></div> ... because with 'display:block;' you change the inline element in block element ^^ What is your goal more precisely? Show us the problematic code ;)
26th Jan 2017, 9:54 AM
visph
visph - avatar
+ 1
Where did you read that? Still few minutes before, I was displaying some :P
27th Jan 2017, 5:24 AM
visph
visph - avatar
0
display: inline-block;?
26th Jan 2017, 9:34 AM
Mini
0
@vidph Yes, I thought so too, but I was confused after reading that "Setting the display property of an element only changes how the element is displayed, not what kind of element it is. So, an inline element with display:block is not allowed to have other block elements inside it."
26th Jan 2017, 8:21 PM
Maxim Velichkin
Maxim Velichkin - avatar