I tried to comment the height:80px; then all buttons are aligned at top vertically, but all buttons will have different height, bring the BUTTONS GROUP look ugly, especially I need to generate over 10 pieces of button
button {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
color: #444;
width: 120px;
height:80px !important;
display:inline-block;
padding:5px;
margin: 5px 10px;
background-color: #fdfdfd;
border: 1px solid #cdcdcd;
cursor: pointer;
border-radius: 3px;
word-wrap: break-word;
}
<button>Text in one row </button>
<button>Text in more than one row in this button </button>
<button>Text in more than two rows in this button which have same height </button>
<button>Text in more than three rows in this button which have same height, but more text </button>
If you add vertical-align: top;
to your button
element this will resolve your problem
CSS
button {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
color: #444;
width: 120px;
height: 80px;
display: inline-block;
padding: 5px;
margin: 5px 10px;
background-color: #fdfdfd;
border: 1px solid #cdcdcd;
cursor: pointer;
border-radius: 3px;
word-wrap: break-word;
vertical-align: top;
}
Run the code snippet below to see the result
button {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
color: #444;
width: 120px;
height: 80px;
display: inline-block;
padding:5px;
margin: 5px 10px;
background-color: #fdfdfd;
border: 1px solid #cdcdcd;
cursor: pointer;
border-radius: 3px;
word-wrap: break-word;
vertical-align: top;
}
<button>Text in one row </button>
<button>Text in more than one row in this button </button>
<button>Text in more than two rows in this button which have same height </button>
<button>Text in more than three rows in this button which have same height, but more text </button>