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

前端 未结 7 694
灰色年华
灰色年华 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:14

    This should do the trick:-

    By default a is an inline element and width does not affect them. So change it to inline-block to have it take the width you specify.

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

    Fiddle

提交回复
热议问题