Make a div into a link

后端 未结 27 1552
栀梦
栀梦 2020-11-22 03:15

I have a

block with some fancy visual content that I don\'t want to change. I want to make it a clickable link.

I\'m looking for something l

27条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 04:13

    An option that hasn't been mentioned is using flex. By applying flex: 1 to the a tag, it expands to fit the container.

    div {
      height: 100px;
      width: 100px;
      display: flex;
      border: 1px solid;
    }
    
    a {
      flex: 1;
    }

提交回复
热议问题