CSS link styles

CSS link style:

a :link (not visited)



#a:hover

a:visited (visited: actually reached that page)

a:active (between mouse click and release) (interval, has no effect on a objects without href attributes)

These elements have different order when defining CSS, which will directly lead to different link display effects.

Specificity is sorted from general to special: link--visited--hover--active

The desired effect can be achieved as follows:

a:link {color: blue}

a:visited{color: red}

##a:hover{color: yellow}

a:active{color: white}

If defined like this:


a:hover{color: yellow}

a:link{color: blue}

a:visited{color: red}

a:active{color: white}

You can’t see hover It works, because :link is the most general effect and its scope is greater than hover, so the previous sentence is covered.

Example:

    链接样式  

这是一个 link

注意: hover必须在:link和 a:visited之后定义才有效.

注意: active必须在hover之后定义是有效的.

Continuing Learning
||
链接样式

链接的状态

  • a:link - 普通的、未被访问的链接
  • a:visited - 用户已访问的链接
  • a:hover - 鼠标指针位于链接的上方
  • a:active - 链接被点击的时刻

这是一个链接

注释:

  1. a:hover 必须位于 a:link 和 a:visited 之后
  2. a:active 必须位于 a:hover 之后

自定义链接的下划线样式

自定义链接的背景色样式

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!