我有一個包含兩個孩子的div,每個孩子都使用bootstrap的列進行構建。但是,在這些div中,我需要做的是對於左側div,我有一些圖標需要垂直對齊,並且相對於右側的div居中。如何垂直對齊填充div旁邊的div?
右邊的div包含一個充當按鈕的錨定標記,並有一些填充。這會導致按鈕向下延伸,而左側的div不會佔用剩餘的高度。
我在這裏附上了一個 codepen 來顯示我在說什麼。
.shareContainer {
padding: 28px 0px;
}
.row {
background: #eee !important;
}
.fa-icon {
margin-left: 20px;
font-size: 2.2em;
color: #ff7350;
}
.button {
display: inline-block;
padding: 18px 50px;
padding-right: 30px;
font-size: 17px;
font-weight: 400;
font-family: "Lato";
border-radius: 2px;
letter-spacing: 0.01em;
color: #fff !important;
text-transform: uppercase;
background-color: #fb8669;
box-shadow: none;
border: none;
}
.arrowRight {
float: right;
margin-left: 20px;
}
.button:active,
.button:focus,
.button:hover {
text-transform: uppercase;
color: #fff;
text-decoration: none;
cursor: pointer;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class='container shareContainer'>
<div class='row'>
<div class="col-sm-8">
<i class='fa fa-share-square-o fa-icon'></i>
<i class='fa fa-facebook-square fa-icon'></i>
<i class='fa fa-twitter fa-icon'></i>
</div>
<div class="col-sm-4">
<a target="_blank" class='button' }>
register for event <svg class='arrowRight'width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" id="arrow-right"><path d="M9 4l7 8-7 8" stroke="currentColor" stroke-width="2" fill="none" fill-rule="evenodd"></path></svg>
</a>
</div>
</div>
</div>
這有助於最。即時通訊不在引導程序4上(意外地將其放在代碼中),即時通訊3,這是如何使其工作的最簡單的解釋。我需要學習flexbox。 –