Skip to content

Instantly share code, notes, and snippets.

@nguyenvanduocit
Last active January 14, 2016 16:24
Show Gist options
  • Save nguyenvanduocit/245a2da96ac46f008dbf to your computer and use it in GitHub Desktop.
Save nguyenvanduocit/245a2da96ac46f008dbf to your computer and use it in GitHub Desktop.
Css tech to horizontal align text div with word wrapable
<div class="sidebar-top-author">
<img class="author-avatar" src="images/avatar.png" alt="">
<div class="author-name">
<div class="author-name-inner">
<span class="author-name-text">Duoc Nguyen</span>
</div>
</div>
</div>
.sidebar .sidebar-top {
height: 8.9rem;
width: 100%;
background: #2ECC71;
position: relative;
}
.sidebar .sidebar-top .sidebar-top-author {
height: 4.8rem;
width: 16.8rem;
margin: auto;
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
top: 0;
bottom: 0;
margin-top: auto;
margin-bottom: auto;
}
.sidebar .sidebar-top .sidebar-top-author .author-avatar {
height: 4.8rem;
width: 4.8rem;
}
.sidebar .sidebar-top .sidebar-top-author .author-name {
height: 4.8rem;
width: 10.8rem;
overflow: hidden;
display: inline-block;
position: absolute;
margin-left: 1.2rem;
top: 0;
bottom: 0;
margin-top: auto;
margin-bottom: auto;
}
.sidebar .sidebar-top .sidebar-top-author .author-name .author-name-inner {
display: table;
height: 100%;
}
.sidebar .sidebar-top .sidebar-top-author .author-name .author-name-inner .author-name-text {
font-family: "Proxima Nova";
font-size: 1.3rem;
color: #FFFFFF;
text-transform: uppercase;
letter-spacing: 0.05rem;
display: table-cell;
vertical-align: middle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment