Can we use css overflow property with inline-block element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we use css overflow property with inline-block element?

Yeah... I checked and it's working but... is it valid ?

24th Jan 2021, 8:19 AM
Gautam Yadav
Gautam Yadav - avatar
3 Answers
+ 1
No, CSS "overflow" property should work only with block (or display: block) elements with specified height. [Source: https://www.w3schools.com/cssref/pr_pos_overflow.asp] But... I do not know if there is "valid property using" term in CSS. So you can use it unless you found that it is working not in all devices/browsers.
24th Jan 2021, 8:23 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
Yes it's valid... even with inline (non-block) elements (but they are turned to block for any value other than 'visible'): "Specifying a value other than visible (the default) creates a new block formatting context. This is necessary for technical reasons — if a float intersected with the scrolling element it would forcibly rewrap the content after each scroll step, leading to a slow scrolling experience." source: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
24th Jan 2021, 8:29 AM
visph
visph - avatar
- 1
get hmm... 🙂
24th Jan 2021, 8:25 AM
Gautam Yadav
Gautam Yadav - avatar