CSS 和 html 是:
<div class="row">
<div class="col-lg-10">
<div class="athlete-image">
<img src="{{ url('assets/img/profile.png') }}" class="img-circle img-responsive img-center">
</div>
<div class="info-pad">
<div class="athlete-name">
<h4>{{ $an_athlete->name }} {{ $an_athlete->surname }}</h4>
</div>
<div class="athlete-info">
<p><i class="fa fa-phone athlete-info-icon" aria-hidden="true"></i> {{ $an_athlete->cellphone }}</p>
<p><i class="fa fa-male athlete-info-icon" aria-hidden="true"></i> {{ $an_athlete->gender }}</p>
<p><i class="fa fa-female athlete-info-icon" aria-hidden="true"></i> {{ $an_athlete->gender }}</p>
</div>
<div class="action-btns">
<a href="{{ route('admin.edit_athlete', ['athlete' => $an_athlete->id]) }}" class="btn btn-labeled btn-info">
<span class="btn-label"><i class="fa fa-pencil"></i></span>Edit Profile</a>
<a href="{{ route('admin.test_athlete', ['athlete' => $an_athlete->id]) }}" class="btn btn-labeled btn-info" role="button">
<span class="btn-label"><i class="fa fa-heartbeat"></i></span>Create New Test Day</a>
</div>
</div>
</div>
.athlete-image {
max-height:100px;
max-width:100px;
overflow:hidden;
padding-top: 10px;
padding-left: 10px;
margin-bottom: 20px;
float: left;
}
.info-pad {
margin-left: 15px;
float: left;
}
.athlete-name {
margin-top: 5px;
}
.athlete-info {
display: inline-block;
float: left;
}
.athlete-info > p {
font-size: 14px;
color: #666666;
float: left;
padding-right: 12px;
display: inline-block;
}
.action-btns{
padding: 15px 0px;
}
我试过添加 <div style="clear: both;"></div>
在操作按钮之后,包括 float: left
在 Action 按钮 CSS 中。没有帮助。
如果我缩短按钮标签,它会正常工作并正确对齐。
问题:为什么两个蓝色按钮不是挨着的?
最佳答案
您必须使用 clear:both
来清除 float 元素。
只需添加以下CSS
即可解决此问题
.action-btns{
padding: 15px 0px;
clear: both;
}
关于html - float 元素下的按钮对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43611319/