Skip to content

Instantly share code, notes, and snippets.

@JoanClaret
Last active August 29, 2015 14:15
Show Gist options
  • Save JoanClaret/0f701470b0a880eb19e0 to your computer and use it in GitHub Desktop.
Save JoanClaret/0f701470b0a880eb19e0 to your computer and use it in GitHub Desktop.
Make all div clickable with CSS using absolute positioning
<h1>Make all div clickable with CSS <span>using absolute positioning</span></h2>
<div>
<a href="https://github.com/JoanClaret/" title="Github link">Github link</a>
<h2>Joan's Github</h2>
<p>Mixtape blog readymade, pork belly DIY sriracha hoodie. Cred gentrify freegan, swag DIY 90's tilde tousled listicle Thundercats. Seitan taxidermy Helvetica Blue Bottle, slow-carb Tumblr letterpress ugh plaid Thundercats mlkshk.
</p>
</div>
*{
margin:0;
padding:0;
}
body{
font-family:"Helvetica", "Helvetica neue", Arial;
padding:20px;
}
h1{
color:#3498db;
}
h1 span{
display: block;
font-size: 20px;
}
h2{
margin-bottom:10px;
}
div{
position:relative;
width:300px;
margin:30px 0;
background-color:#ccc;
padding:10px;
}
a{
position:absolute;
left:0;
right:0;
top:0;
bottom:0;
text-indent:-100%;
}
@JoanClaret
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment