Which styling rules are applied to make the vertical align property work with divs? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which styling rules are applied to make the vertical align property work with divs?

14th Feb 2017, 8:52 AM
Emmanuel Nuotah
3 Answers
+ 8
display: table-cell
14th Feb 2017, 9:54 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
'display:inline-block' ( with dash and in this order ^^ ) is not really a good answer, is much more an hack, which could work in some contexts, but not every and to make vertical align work relatively to outside of the element, contrarly at 'table-cell' value wich apply a behaviour to content alignment... Anyway, 'table-cell' is a solution by default for a long time ( before usage of 'display' css property, web designers had abused of <table> family element to make layout ), but have some disadvantages, and can be hard to handle ( if not impossible ) in some contexts... Today, the only real good answer to the question, is 'Flex': display:flex; display:inline-flex; https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes
14th Feb 2017, 11:09 AM
visph
visph - avatar
0
display:table-cell display:block inline
14th Feb 2017, 10:18 AM
Emmanuel Nuotah