Home  >  Article  >  Web Front-end  >  a标签伪类的作用及书写顺序是什么_HTML/Xhtml_网页制作

a标签伪类的作用及书写顺序是什么_HTML/Xhtml_网页制作

WBOY
WBOYOriginal
2016-05-16 16:39:451497browse
a标签伪类的作用:

":link": a标签还未被访问的状态;

":visited": a标签已被访问过的状态;

":hover": 鼠标悬停在a标签上的状态;

":active": a标签被鼠标按着时的状态;

写样式时,为毛要按这个顺序写:

其实本质还是“同等优先权的样式,写在后边的会覆盖前边”,a标签的伪类只不过是又结合了不同的动作顺序,动作的触发顺序决定了伪类的顺序必须按lvha来写。

下面结合这4个伪类简单说下:

因为前2者两种状态是常态,而后2者是即时状态,当即时状态触发时,要覆盖常态,所以2个即时状态要放在后边;

因为在常态下:如果a标签被访问过后,就要呈现被访问过的状态,所以visited 要放在link后边;

因为鼠标按下时,伴随着悬停的a标签上,所以要想active覆盖hover,就必须把active放后边;

顺序记忆技巧:

lv包hao用
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn