Created
November 30, 2015 11:18
-
-
Save Artur-Sulej/9f354ffaf195914c2b89 to your computer and use it in GitHub Desktop.
CSS class making image fit screen width
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
<style type="text/css"> | |
.img_fitted { | |
background-position: center; | |
background-size:cover; | |
width: 100%; | |
color: #fff; | |
} | |
.img_fitted img { | |
max-width: 100%; | |
} | |
</style> | |
<!-- ... --> | |
<div class="img_fitted" style="background-image: url(background)"> | |
<!-- ... --> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment