Created
October 21, 2016 09:32
-
-
Save DriginCode/b25aa81aa24eca628e79e7ae36751dce 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
Если ты используешь картинку как фон в header используй: | |
header{ | |
background:url(path_to_your_image) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
height: 100px; | |
} | |
Пример: https://jsfiddle.net/NikitaSmith/uz2n1r3p/4/ | |
Если ты хочешь использовать картину внутри блока,чтобы она была адаптивной: HTML: | |
<img src="path/to/your/image" alt=""> | |
</header> | |
CSS: | |
#background { | |
position: fixed; | |
top: 0; | |
left: 0; | |
/* Preserve aspet ratio */ | |
min-width: 100%; | |
height: 200px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment