我有一个包含显示项目的框:内联块.如果框中的项目没有填满整行,我需要在中间对齐内容,但在左边对齐项目.
我试图在内联块中设置整个内容,但这仅在只有一行项目而不是两行或更多行时才有效.此外,我需要它响应,所以不能使用固定缩进.
码:
.booking-time{
font-size: 0;
line-height: 0;
border: 1px solid red;
padding: 5px;
text-align: center;
}
.inner{
display: inline-block;
text-align: left;
}
.btn{
width: 100px;
background: #3578d5;
color: #fff;
display: inline-block;
vertical-align: middle;
font-size: 14px;
line-height: 20px;
padding: 8px 16px;
font-weight: 500;
text-align: center;
text-decoration: none;
text-transform: uppercase;
cursor: pointer;
border: none;
border-radius: 2px;
overflow: hidden;
position: relative;
transition: box-shadow 0.3s, color 0.3s, background 0.3s;
margin: 0 5px 5px 0;
}Run Code Online (Sandbox Code Playgroud)
<div class="booking-time">
<div class="inner">
<button type="button" class="btn …Run Code Online (Sandbox Code Playgroud)