css - Do I need to specify each link color state? -


i'm using following pseudo classes:

a.recentposttitle:link,a.recentposttitle:visited {color:#000;} a.recentposttitle:hover {color:#56a49f;} a.recentposttitle:active {color:#000;} 

do need explicit or there more compressed way same result?

no, there no shorthand. selectors can be:

a {} 

to select links, or:

.recentposttitle {} 

to .recentposttitle elements (we know links already).


and thing, :link not needed really, can write:

a {} a:visited {} a:hover {} a:active {} 

when write a {}, set declaration possible situations, so:

a {} 

is identical to:

a:link, a:visited, a:hover, a:active {} 
  • and remember, order of pseudo classes importent:
    • :link
    • :visited
    • :hover
    • :active
  • or remember love hate.

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -