css - How can I make a link inside a div fill the entire space inside the div? -


i have div has set width , wrapped around link. want link inside fill entire space of div when click anywhere inside div (which have styled button) goes link. have tried, .link_class doesn't want. suggestions?

html:

<div class="button_class">     <a class="link_class" href="http://www.my_link.com>my link</a> </div> 

css:

.button_class {     width:150px;     padding:5px 7px;     color:#fff;     text-align:center;     -webkit-border-radius:3px;     -moz-border-radius:3px;     border-radius:3px; }  .link_class {     width:100%;     height:100%; } 

this should trick:-

by default a inline element , width not affect them. change inline-block have take width specify.

.link_class {     display:inline-block;     width:100%;     height:100%; } 

fiddle


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -