Skip to content

Instantly share code, notes, and snippets.

@wandbferreira
Last active July 12, 2017 13:06
Show Gist options
  • Save wandbferreira/ed28ff8181b6d2110ffa0d4f88c26204 to your computer and use it in GitHub Desktop.
Save wandbferreira/ed28ff8181b6d2110ffa0d4f88c26204 to your computer and use it in GitHub Desktop.
Permite alinhamento Vertical
/* Div centralizada */
.classe {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
/* Imagem centralizada */
.img-center{
background: #FFF;
width: 100%;
padding-top: 75%;
padding-top: calc(75% - 20px); /* fix border-width */
text-align: center;
margin: 0;
position: relative;
}
.img-center img{
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment