Skip to content

Instantly share code, notes, and snippets.

@piyonishi
Created February 21, 2016 19:15
Show Gist options
  • Save piyonishi/46a8f2af9eeb632fed36 to your computer and use it in GitHub Desktop.
Save piyonishi/46a8f2af9eeb632fed36 to your computer and use it in GitHub Desktop.
ratio.css
.pannel {
display: block;
position: relative;
width: 100%;
&:before {
content: "";
display: block;
padding-top: 50%;
}
img {
margin: 0 auto;
position: absolute;
left: 0;
right: 0;
top: 0;
max-width: 100%;
max-height: 100%;
}
}
@piyonishi
Copy link
Author

画像の比率を保つことが出来る。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment