-
-
Save nathggns/2889812 to your computer and use it in GitHub Desktop.
@AdamWhitcroft's "dot" effect in pure css. http://adamwhitcroft.com
This file contains hidden or 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
/** | |
* @adamwhitcroft's "dot" effect in pure css. http://adamwhitcroft.com | |
* I made it as reall as possible, but the grid lines are darker, rather | |
* than the spaces between them, like in Adam's version. | |
* Compare to http://adamwhitcroft.com/wp-content/themes/Fifth/img/dot.png | |
*/ | |
/* Make sure the image stays in it's container */ | |
img { max-width: 100%; } | |
/* Center the image */ | |
.poster { | |
position: absolute; | |
top: 50%; left: 50%; | |
margin-left: -250px; margin-top: -168.5px; | |
width: 500px; | |
} | |
/* The real work */ | |
.poster:before { | |
content: ''; /* Make it a valid pseudo-element */ | |
/* Make it the full size, minus the little space images add? */ | |
position: absolute; | |
left: 0; right: 0; bottom: 5px; top: 0; | |
/* | |
* Make the grid. | |
* It had to be made of black or the dots would get darker where the grid lines crossed. | |
* Because of this, we use opacity to change the black to a translucent black. | |
*/ | |
background-image: linear-gradient(black 50%, transparent 50%), linear-gradient(left, transparent 50%, black 50%); | |
background-size: 2px 2px; | |
opacity: 0.5; /* Adjust to preference */ | |
} |
This file contains hidden or 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="poster"> | |
<img src="http://assets.nath.is/blog/posts/texture.jpg"> | |
</div> |
This file contains hidden or 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":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment