グラム次いで、次の円にテキストの周囲に容器div
を追加display:flex
、align-items:center
とjustify-content:center
すなわち HTML親コンテナをアイブ
<div class="public_profile">
<div class="profile_image business">
<img src="img/realestate_icon.png" />
</div>
<div class="profile-container">
<h4>BUSINESS ACCOUNT</h4>
<h3>Sunny Real Estate Sarl.</h3>
<hr class="business_line" />
<h5>VERIFIED USER</h5>
<h5 class="registered">Registered on January 27th 2016</h5>
</div>
</div>
.public_profile{
float: left;
width: 100%;
display:flex;
align-items:center;
justify-content:center;
border:solid 1px red;
}
.public_profile .profile-container {
border:solid 1px green;
}
.public_profile .profile_image{
border-radius: 50%;
float: left;
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 15px;
overflow: hidden;
}
.public_profile .profile_image.business{
background-color: #fdb902;
}
.public_profile .profile_image img{
width: 100%;
height: 100%;
}
.public_profile h4{
font-family: 'OpenSans-ExtraBold';
font-size: 12px;
color: #a1d15f;
margin: 0;
}
.public_profile h3{
font-family: 'OpenSans-Light';
font-size: 24px;
color: #1e1e1e;
margin: 0;
}
.public_profile h5{
font-family: 'OpenSans-Regular';
font-size: 12px;
color: #4d5663;
margin: 0;
}
.public_profile h5.registered{
font-size: 11px;
color: #4c4d4d;
}
hr.business_line{
margin-top: 0;
margin-bottom: 0;
width: 30px;
display: inline-block;
border-top: 2px solid #a1d15f;
}
は
CSS(注:境界は表示目的のために純粋にされている)
Fiddle example
編集:OK、少し誤解があったので、円の横にテキストを縦に配置し、すべてを水平に配置すると、コンテナ内のalign-items:center
はすべて垂直方向に中央に配置され、justify-content:center
は水平に配置されます。問題:)
あなたが水平または垂直方向に円やテキストを配置しますか? – Pugazh