Skip to content

Instantly share code, notes, and snippets.

@ghernandez345
Last active December 18, 2015 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghernandez345/5754028 to your computer and use it in GitHub Desktop.
Save ghernandez345/5754028 to your computer and use it in GitHub Desktop.
how to properly expand anchor tags when they contain children.
<!-- this anchor contains some other html elements as it's children. By default it will NOT
expand to the size of its children. It's demensions in the browser will be 0x0 until you implement the correct css. -->
<a href="#someLink" class="some-link-button">
<div class="button">Click here</div>
</a>
/**
* You must make the anchor tag display block or even inline-block if you want to get fancy. Without
* this, the anchor tag will always have demensions 0x0 no matter what you put in it.
*/
a.some-link-button {
display: block;
}
.button {
width: 300px;
height: 50px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment