网上很多关于在一个网页中想定义不同的链接样式要怎么写的问题,今天总结了下,常用的三种写法:
第一种写法:
Example Source Code
a.style1{text-decoration:none;}
a.style1:hover{color:#fff;background-color:#FF5900;}
a.style1:active{color:#FF5900;}
<a href="http://www.woaicss.com/" class="style1">蜗爱CSS</a>
第二种写法
Example Source Code
.style2 a {text-decoration: none;color: #000; }
.style2 a:visited {color: #ccc;}
.style2 a:hover {color: #f60;}
<span class="style2">
<a href="http://www.woaicss.com/">蜗爱CSS</a>
</span>
第三种写法
Example Source Code
a .style3 {text-decoration: none;}
a:hover .style3 {color: red;}
a:active .style3 {color: #f60;}
<a href="http://www.woaicss.com/">
<span class="style3">蜗爱CSS</span>
</a>
转载请注明:睿美印象
网站建设工作室www.ruimeiyx.com