Skip to content

Instantly share code, notes, and snippets.

Created June 4, 2013 07:37
Show Gist options
  • Save anonymous/5704248 to your computer and use it in GitHub Desktop.
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?
/**
* 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;
}
<div class="clickable-area">
<a href="#">click </a>
</div>
// alert('Hello world!');
{"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