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

前端 未结 7 621
灰色年华
灰色年华 2020-12-30 18:27

I have a div that has a set width and it is wrapped around a link. I want the link inside to fill the entire space of the div so that when I click

相关标签:
7条回答
  • 2020-12-30 19:17

    Here is the Solution.

    The HTML:

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

    The CSS:

    .button_class {
        width:150px;
        color:#fff;
        text-align:center;
        -webkit-border-radius:3px;
        -moz-border-radius:3px;
        border-radius:3px;
        background:blue;
    }
    
    .link_class {
        display:block;
        color:#ffffff;
        overflow:auto;
        padding:5px 7px;    
    }
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题