Created
June 4, 2013 07:37
-
-
Save anonymous/5704248 to your computer and use it in GitHub Desktop.
How do I position a link relatively to background-image with background-size contain?
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
/** | |
* How do I position a link relatively to background-image with background-size contain? | |
*/ | |
html, body { | |
height: 100%;width:100%;display:table; | |
} | |
body { | |
background: #fff url(http://www.apple-weblog.de/wp-content/uploads/2007/10/Leopard.jpg) no-repeat center center; | |
background-size: contain; | |
margin: 0; | |
display:table-cell; | |
vertical-align:middle; | |
} | |
.clickable-area { | |
border: 1px solid red; | |
margin: -7.5% 0 0 -10%; | |
margin:auto; | |
width: 20%; | |
height: 15%; | |
display:table; | |
} | |
a { | |
display:table-cell; | |
text-align:center; | |
vertical-align:middle; | |
} |
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="clickable-area"> | |
<a href="#">click </a> | |
</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
// alert('Hello world!'); |
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-vertical","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