Created
August 25, 2012 18:45
-
-
Save tylergaw/3469117 to your computer and use it in GitHub Desktop.
Flexible background image and height with vw
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
/** | |
* Flexible background image and height with vw | |
*/ | |
div { | |
background: transparent url("https://www.djangoproject.com/m/img/logos/django-logo-positive.png") no-repeat center top; | |
background-size: 90%; | |
height: 28vw; | |
width: 90%; | |
} |
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></div> | |
<p> | |
Content that should come after the image. Usually you'd need to do some trickery with the div. | |
My normal method is to put a percentage padding-top on it. I've never found a formula for what | |
percentage works, I just tinker around with it until it works. This feels much better. | |
</p> |
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":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment