Created
October 22, 2015 06:44
-
-
Save pistatium/fcc1066dce29732d38bb to your computer and use it in GitHub Desktop.
responsive image
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
.box1 { | |
width: 100px; | |
height: 200px; | |
} | |
.box2 { | |
width: 300px; | |
height: 500px; | |
} | |
div { | |
position: relative; | |
background-color: #000; | |
margin-bottom: 30px; | |
} | |
div img { | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
margin: auto; | |
width: auto; | |
max-width: 100%; | |
height: auto; | |
max-height: 100%; | |
} |
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="box1"><img src="http://placehold.it/300x250" alt="" /></div> | |
<div class="box2"><img src="http://placehold.it/300x250" alt="" /></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment