How do I make an tag the size of it's parent
  • tag for larger clickable region?
  • 前端 未结 7 1413
    我在风中等你
    我在风中等你 2020-12-08 04:11

    I would like to do this so that the clickable region on the tag is size of the LI.

    My html looks like:

  • 7条回答
    •  生来不讨喜
      2020-12-08 04:48

      In CSS:

      li a {
           display: block;
      }
      

      Of course, you'll want to make your selector more specific than that.

      
      
      li.myClass a {
          display: block;
          background-color: #fdd; /* Demo only */
      }
      

      http://jsfiddle.net/userdude/jmj2k/

    提交回复
    热议问题