css偽類中關於visited樣式無效的解決方案

來源:互聯網
上載者:User
錯誤寫法 將visited寫在hover和active之後,例如:

.ui-page-theme-a .digilinx-ui-btn{background:#00a325;border-color:#00891f;color:#FFF;text-shadow: 0 1px 0 #00a325;}.ui-page-theme-a .digilinx-ui-btn:hover{background:#00891f;border-color:#00721a;color:#FFF;text-shadow: 0 1px 0 #00891f;}.ui-page-theme-a .digilinx-ui-btn:active{background:#00721a;border-color:#005c15;color:#FFF;text-shadow: 0 1px 0 #00721a;}.ui-page-theme-a .digilinx-ui-btn:visited{background:#00a325;border-color:#00891f;color:#FFF;text-shadow: 0 1px 0 #00a325;}

造成的結果:點擊過的按鈕或者連結的樣式將會一直固定在visited上,hover和active的樣式講會被覆蓋

正確寫法 將visited寫在前面,如下:

.ui-page-theme-a .digilinx-ui-btn{background:#00a325;border-color:#00891f;color:#FFF;text-shadow: 0 1px 0 #00a325;}.ui-page-theme-a .digilinx-ui-btn:visited{background:#00a325;border-color:#00891f;color:#FFF;text-shadow: 0 1px 0 #00a325;}.ui-page-theme-a .digilinx-ui-btn:hover{background:#00891f;border-color:#00721a;color:#FFF;text-shadow: 0 1px 0 #00891f;}.ui-page-theme-a .digilinx-ui-btn:active{background:#00721a;border-color:#005c15;color:#FFF;text-shadow: 0 1px 0 #00721a;}
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.