user4942732
user4942732

Reputation:

What are some of the : codes for CSS

If you didn't understand my question- im asking what are some other CSS codes like :hover, like different things you would put into the :part. I tried searching it up, but cant find much, so I would appreciate if somebody could help me.

Upvotes: 0

Views: 68

Answers (5)

Stewartside
Stewartside

Reputation: 20905

There are quite a number of pseudo-classes that you can use, either for links, identifying content and in CSS3, determining outputs.

They can all be found here: Advanced CSS Selectors - Pseudo Classes

  • :link - the normal, default state of links, just as you first found them.
  • :visited - selects links that you have already visited in the browser you are currently using.
  • :hover - selects links that currently have the keyboard cursor within them.
  • :focus - selects links that are currently being hovered over by the mouse pointer.
  • :active - selects links that are currently being clicked on.
  • :not() - selects elements that are not matched in the braces
  • :lang() - selects elements whose languages have been set to the specified language using the lang attribute.
  • :target - select an element if it is the target of the current page URL.
  • :valid - HTML5 - form valid
  • :invalid - HTML5 - form invalid
  • :enabled - HTML5 - form field enabled
  • :disabled - HTML5 - form field disabled
  • :root - elements based on their position in the document hierarchy.
  • :nth-child() - selects elements that match within the braces
  • :first-child - selects the first element within a selector
  • :last-child - selects the last element within a selector
  • :first-letter - selects the first letter of text
  • :first-line - selects the first line of text
  • :before - element to specify that content should be inserted before
  • :after - elements to specify that content should be inserted after

Also, don't forget about double colon syntax. Note that the new CSS3 way of writing pseudo-elements is to use a double colon, eg a::after { ... }, to set them apart from pseudo-classes. You may see this sometimes in CSS. CSS3 however also still allows for single colon pseudo-elements, for the sake of backwards compatibility, and we would advise that you stick with this syntax for the time being.

Upvotes: 3

Sherizan
Sherizan

Reputation: 21

The anchor tags should be in this order:

  • a:link
  • a:visited
  • a:hover
  • a:active

Or as they teach in school, LoVe / HAte to remember it next time you have to code the tags out.

Other than those ones, there's pseudo selectors like :first-child, :last-child as well as :before and :after which is used a lot.

Find more examples here: https://css-tricks.com/pseudo-class-selectors/

Upvotes: 1

user4974193
user4974193

Reputation:

You mean pseudo-classes. There is a list here http://www.w3schools.com/css/css_pseudo_classes.asp

Upvotes: 0

Alex McMillan
Alex McMillan

Reputation: 17952

These are called CSS pseudo-classes and include:

  • :link
  • :visited
  • :focus
  • :hover
  • :active

Upvotes: 2

jwatts1980
jwatts1980

Reputation: 7356

They are called pseudo classes: http://www.w3schools.com/css/css_pseudo_classes.asp

Upvotes: 0

Related Questions