← All elements

Magnifying Dock Menu

by @admin · 0 views

<ul class="dk"><li><button type="button" aria-label="Files">▤</button></li><li><button type="button" aria-label="Mail">✉</button></li><li><button type="button" aria-label="Music">♫</button></li><li><button type="button" aria-label="Photos">❀</button></li><li><button type="button" aria-label="Settings">⚙</button></li></ul>

About this hover effect

An app dock where the hovered icon grows and its neighbours grow a little, found with the :has() selector.

How it works

The hovered or focused item enlarges its button. The item right after it grows a little through the sibling selector, and the item before it through :has(), which can look ahead. Animating width and height lets the other icons make room, like a desktop dock.

Ways to customise it

  • Change the 60px and 49px sizes.
  • Replace the symbols with SVG icons.
  • Change the dock background and blur.

Good to know

Every icon has an accessible name and a focus ring. Touch devices do not hover, so the buttons must be usable at their resting size, which is 40 pixels.

Open an example, copy the HTML and the CSS, and paste them into your page. There is nothing to install and no JavaScript to load.

More in Hover

View all →