The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › vertical centering doesn't work for element
vertical centering doesn’t work on legend element..
display:table-cell; vertical-align:middle;
any ideas..? I have some text inside legend element, which I want to be centered vertically inside…
thank you..
Thank You Jamy…
tried it with no luck….
pen here
looks like User agent style sheet is overriding display:table-cell..
display:table-cell
I tried !important.. even though it is not working…
!important
You don’t really need a table at all to achieve it…
table
Remove
height:50px; width:30%;
from legend and then adjust the element’s height by padding and/or line-height
legend
padding
line-height
PEN
@Tomasz,
It works… I wonder what height has to do with display:table-cell?
height
display:table-cell works for div even though you mention height for the div…
div
can you please explain this difference…?