【发布时间】:2019-12-28 04:57:22
【问题描述】:
固定高度的按钮 css 使垂直位置很难看,因为每个按钮文本都不止一行
我尝试评论 height:80px; 然后所有按钮在顶部垂直对齐,但是所有按钮的高度不同,使 BUTTONS GROUP 看起来很难看,特别是我需要生成超过 10 个按钮
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>
如何使按钮的高度固定,并且所有按钮都位于垂直顶部。 注意:每个按钮有不同的字数,自动换行为 1 行、2 行、3 行...
【问题讨论】:
标签: css button height word-wrap