Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] How to align buttons (with height and width) horizontally?

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #202896
    hcd1
    Participant

    just three buttons

    <button>button</button>
    <button>button button button button</button>
    <button>button</button>


    and
    button{
    width:100px;
    height:100px;
    }

    the second button fall out of alignment

    http://jsfiddle.net/pztq29LL/1/

    #202897
    Paulie_D
    Member

    inputs are inline elements and so their default vertical alignment is baseline.

    You would need to set this (I would suggest) to top

    button {
        width:100px;
        height:100px;
        vertical-align: top;
    }
    

    JSfiddle

    #202898
    hcd1
    Participant

    cool

    so there is no difference in this case between vertical-align: top; and vertical-align: middle; ?

    http://jsfiddle.net/pztq29LL/7/

    #202899
    Paulie_D
    Member

    Normally it would but it’s just that all of your buttons are the same size in this case….try taking the height off.

    Jsfiddle

    #202910
    pramodn
    Participant

    Use float:left and margin-left:10px;

    http://jsfiddle.net/pztq29LL/17/

    #202913
    hcd1
    Participant

    i need them in the center and stacked http://jsfiddle.net/pztq29LL/7/

    #202916
    Paulie_D
    Member

    I’m not sure what you are asking…they seem to be centered.

    What does ‘stacked’ mean.

    What is this supposed to look like?

    #202918
    hcd1
    Participant

    Actually this is what I needed eventually:
    http://jsfiddle.net/pztq29LL/19/

    rows are centered horizontally, text inside centered vertically, and if there are too many buttons, they overflow on the next row. That’s what i called stacking, may be wrongly

    In some other case I may need divs, but I know it is either flex or a bunch of markup for such a scenario

    #202921
    Paulie_D
    Member

    Nope still not getting it.

    rows are centered horizontally, text inside centered vertically, and if there are too many buttons, they overflow on the next row. That’s what i called stacking, may be wrongly

    Isn’t that exactly what you have now?

    #202923
    hcd1
    Participant

    yes i got what i wanted both initial question and the bigger thing.

    thanks!!

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