Created
May 16, 2013 15:26
-
-
Save JohannesMP/5592550 to your computer and use it in GitHub Desktop.
Template: aspect-ratio locked Divs floating to center with outline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Template: aspect-ratio locked Divs floating to center with outline | |
*/ | |
.container { | |
text-align: center; | |
} | |
.image-wrapper { | |
display: inline-block; | |
width: 100%; | |
max-width: 600px; | |
background-size:100%; | |
background: url(http://i.imgur.com/VkUpwPi.png) no-repeat; | |
} | |
.image { | |
width:100%; | |
height:0; | |
padding-top:66.667%; /* 4x3 aspect ratio */ | |
position: relative; /* necessary to keep the position: absolute contained*/ | |
} | |
.image-overlay { | |
position: absolute; | |
top: 0; right: 0; bottom: 0; left: 0; | |
/*background: url(http://i.imgur.com/HeYHtzI.png);*/ | |
background-repeat: no-repeat; | |
background-size: 100% 100%; | |
border: 5px solid rgba(0,0,0,0.5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="image-wrapper"> | |
<div class="image"> | |
<div class="image-overlay"></div> | |
</div> | |
</div> | |
<div class="image-wrapper"> | |
<div class="image"> | |
<div class="image-overlay"></div> | |
</div> | |
</div> | |
<div class="image-wrapper"> | |
<div class="image"> | |
<div class="image-overlay"></div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"separate","fontsize":"80","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment