×

css · level 1 · unit 7 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

changes the style while the pointer is on top.

To hover is to rest the mouse pointer over something without clicking. Pages use it to show what you can click: a button lights up, a link changes colour.

:hover goes straight after a selector, with no space: button:hover. It is a , a word after a colon that picks elements only while they are in a certain state.

The normal rule sets the usual look, and the hover rule only lists what changes. Touch screens have no pointer, so never hide anything important behind a hover.

<button class="go">Start</button>
.go {
  color: white;
  background-color: seagreen;
  padding: 12px 24px;
}
.go:hover {
  background-color: darkgreen;
}

Press show my page to see it here.

<button> is a button people can press. Point at it to see the hover colour.