← All elements

Profile Dropdown Menu

by @admin · 0 views

<details class="pd" open><summary aria-label="Account menu">RC</summary><div><p><b>Rina Cruz</b><span>rina@example.com</span></p><a href="#">Your profile</a><a href="#">Billing</a><a href="#">Settings</a><a href="#" class="out">Sign out</a></div></details>

About this menu

An avatar button that opens an account menu with a name header and links, using the details element.

How it works

The avatar is the summary of a details element, so the browser opens and closes the account menu with a click or the Enter key. The menu is a simple card with a name block and links, and the open state adds a ring around the avatar.

Ways to customise it

  • Change the initials, name and links.
  • Change the avatar gradient.
  • Remove the open attribute so it starts closed.

Good to know

A details element does not close when you click elsewhere. If you need that behaviour, use the popover attribute or add a short script.

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 Menu

View all →