Skip to main content

HTML Tags

HTML <selectedcontent> Tag

Learn how the experimental HTML <selectedcontent> tag displays the selected option inside a customizable select button.

The selectedcontent tag is part of the new customizable select. It shows a copy of the option the user picked inside the select's button, including any icon or extra markup in that option. It is still experimental and works only in Chromium browsers.

For years, a <select> drop-down could hardly be styled. Customizable select lets you put rich content, like a flag next to a country name, into the options and style the whole control. <selectedcontent> is how the closed button shows the chosen option.

Syntax

html

<select>
  <button>
    <selectedcontent></selectedcontent>
  </button>

  <option value="html">HTML</option>
  <option value="css">CSS</option>
</select>

The <button> must be the first child of the <select>, and <selectedcontent> goes inside it. When the user picks an option, the browser copies that option's content into <selectedcontent>.

It has no attributes of its own; global ones such as class work.

Example

Compatibility notice: This example uses customizable-select features that may not work in every browser. In unsupported browsers, keep the underlying <select> usable as a standard form control.

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Selectedcontent Tag Example</title>
  <style>
    select,
    ::picker(select) {
      appearance: base-select;
    }

    select {
      min-width: 260px;
      border: 2px solid #29AB87;
      border-radius: 8px;
      padding: 8px;
      font: inherit;
    }

    select > button,
    selectedcontent,
    option {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    option {
      padding: 10px;
    }

    option::checkmark {
      display: none;
    }

    .badge {
      display: inline-grid;
      width: 32px;
      height: 32px;
      place-items: center;
      border-radius: 6px;
      background-color: #e7f8f3;
      color: #007a96;
      font-weight: bold;
    }

    selectedcontent .description {
      display: none;
    }
  </style>
</head>
<body>
  <h1>Choose a Tutorial</h1>

  <label for="tutorial">Tutorial:</label>
  <select id="tutorial" name="tutorial">
    <button>
      <selectedcontent></selectedcontent>
    </button>

    <option value="html" selected>
      <span class="badge">H</span>
      <span>HTML</span>
      <small class="description">Structure webpages</small>
    </option>

    <option value="css">
      <span class="badge">C</span>
      <span>CSS</span>
      <small class="description">Style webpages</small>
    </option>

    <option value="javascript">
      <span class="badge">JS</span>
      <span>JavaScript</span>
      <small class="description">Add interactivity</small>
    </option>
  </select>
</body>
</html>

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
Yes (135+)Yes (Chromium)NoNoYes (Chromium)No

Browser support is still evolving. Current compatibility data reports support in Chrome 135 and later and related Chromium-based browsers, but not in Firefox, Safari, or Internet Explorer. Check current compatibility data before production use.

Use it as an extra

Customizable select needs appearance: base-select in CSS to switch on. Browsers that do not support it show a normal <select>, and that is fine: the form still works, it just looks plainer. Make sure your options make sense as plain text too, because that is what users of other browsers will see.

Learn the basics of the control in the select tag and the option tag.

HTML <selectedcontent> Tag exercises

Show the choice in the button

Add a dropdown named colour. Its first child is a button that holds the selectedcontent element, and then come Red (red) and Blue (blue).

Result

Check your answer to see it here.