Css center text vertically3/10/2024 ![]() If I don’t know the height of the child, it’s quite common for me to also not know the height of the parent.ģ) In your “both hor & vert example” where the height is unknown, it’s a little weird to have the child be pos: absolute and imply that this is no big deal. ![]() ![]() To me, that defeats the purpose of trying to handle the unknown-height scenario. However, I think you’re missing the spirit behind the classic “centering is hard” complaint in a couple of places, which, at least for me, always comes back to not knowing the height of the elements.ġ) Your display: table-cell fix relies on knowing the height of the child element.Ģ) In your “is it block level” -> “is the element of unknown height” you proceed to give the parent an explicit height. Good idea! I like the concept of this article and also the show/hide structure.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |