css: override active link style?

前端 未结 3 1165
感情败类
感情败类 2021-01-29 01:22

i have the following selector in my css:

a:active {
  position: relative;
  top: 1px;
}

So every link has this little button-effect when it\'s

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-29 01:32

    The following

    a#back-to-top:active {
      position:fixed;
      top: auto;
    }
    

    would fix it, since it is more specific and will get applied, and it overrides the part that makes your button move..

    No need for the !important directive since the rule has higher specificity and will get applied instead..

    demo: http://jsfiddle.net/gaby/zUEER/

提交回复
热议问题