Possible to make a:after/before pseudo elements clickable as part of the link?

后端 未结 8 1703
不知归路
不知归路 2020-12-16 09:42

pseudo elements a:after a:before allow you to add text that appears to be part of the link. However, I can\'t seem to figure out a way to make that portion clickable as part

相关标签:
8条回答
  • 2020-12-16 10:21

    Just add this to your css:

    a {padding-right:Ypx} /* Y = size of your url in pixels */
    

    If the size of the URL varies you will have to use javascript to get it.

    0 讨论(0)
  • 2020-12-16 10:23

    I'm hoping someone has a better solution than this, but just in case not, I did come up with this horrible/crappy/hacky solution:

      a {
         margin-right: 40px;
      }
    
      a:after {
         content: " (" attr(href) ")";
         margin-left: -40px;
      }
    
    0 讨论(0)
提交回复
热议问题