Forums

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

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #153585
    sadunaresh
    Participant

    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..

    #153587
    sadunaresh
    Participant

    Thank You Jamy…

    tried it with no luck….

    pen here

    #153588
    sadunaresh
    Participant

    looks like User agent style sheet is overriding display:table-cell..

    I tried !important.. even though it is not working…

    #153589
    Tomasz Lisiecki
    Participant

    You don’t really need a table at all to achieve it…

    Remove

    height:50px;
    width:30%;
    

    from legend and then adjust the element’s height by padding and/or line-height

    PEN

    #153591
    sadunaresh
    Participant

    @Tomasz,

    It works… I wonder what height has to do with display:table-cell?

    display:table-cell works for div even though you mention height for the div…

    can you please explain this difference…?

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.