html - How this div align the middle? -
i have sample:
i want align second div middle of first div...i tried vertical-align:middle
not working.
it because put container display: table
?
code html:
<div class="container-logo"> <div class="logo">logo</div> <div class="profile-name">name</div> </div>
code css:
.container-logo { display: table; margin: 0 auto;} .logo{ clear: none; float: left; height: 57px; width: auto; background:red; } .profile-name{ float: left; width: auto; color: blue; /* line-height: 22px; */ font-size: 14pt; background:aqua; font-family: montserrat regular; }
what problem not work ... can give me advice please?
thanks in advance!
edit:
my items must in line , have same height ... want second div put in middle of first ... same height
<div class="container-logo">
replace class name.
.container-logo { display: table; margin: 0 auto; vertical-align: middle; } .logo{ clear: none; /*float: left;*/ height: 57px; width: auto; background:red; display: table-cell; vertical-align: middle; } .profile-name{ /*float: left;*/ width: auto; /* line-height: 22px; */ font-family: montserrat regular; display: table-cell; vertical-align: middle; } .profile-name p{ font-size: 14pt; background:aqua; color: blue; padding:2px; }
<div class="container-logo"> <div class="logo">logo</div> <div class="profile-name"> <p>name</p> </div> </div>
Comments
Post a Comment