Why ::before pseudo-element not working with :visited pseudo-class?

后端 未结 4 1997
再見小時候
再見小時候 2021-02-02 11:11

I\'m trying to style my element with pseudo-class and pseudo-element. like hover::before is working perfectly but :visited::before is not working.

4条回答
  •  后悔当初
    2021-02-02 12:00

    It is easy, if you have a span next to it:

    *, *:before, *:after {
      box-sizing: border-box;
    }
    body {
      background-color: #eee;
      font-size: 23px;
      padding: 50px;
      font-family: 'Ubuntu Condensed', sans-serif;
    }
    .seen {
      margin: 20px;
      float: left;
      padding: 20px 20px 20px 20px;
      border: 1px solid #ccc;
      background-color: #fff;
      position: relative;
      text-decoration: none;
    }
    .seen {
      color: green;
    }
    .seen:visited {
      color: red;
    }
    .seen + span {
      color: #fff;
      margin-left: 20px;
    }
    .seen:visited + span {
      color: #ccc;
      margin-left: 20px;
    }
    Seen Effects Seen
    Seen Effects Seen
    Seen Effects Seen

    This doesn't work in Chrome, but works in Chromium!

提交回复
热议问题