Nested hyperlinked areas without nested link elements in HTML source

后端 未结 5 1976
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 16:11

I\'d like to have something that looks and behaves as hyperlink inside larger rectangle (full page wide) which is also hyperlink. Below there is ASCII-art representation of what

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-02 16:48

    You could try something like this:

    div.a {
      position: relative;
      background-color: #F88;
      z-index: 0;
    }
    a.b {
      position: relative;
      z-index: 2;
    }
    a.b:hover {
      background-color: #8F8;
    }
    a.c {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
    }
    a.c:hover {
      background-color: #88F;
    }
    a.c span {
      display: none;
    }
    foo bar baz

提交回复
热议问题