Creating sections inside html select tag

0 views - 1 minute readEdit this post

I rely on your support to keep this website running. If you find the content valuable, please consider making a small donation. whether it’s ₹25/$1 or ₹500/$5.

Donate

Secured by Stripe

To create section inside select tag we can use hr tag in between options.

<h1>Selector</h1>

<select>
  <option>HTML</option>
  <option>CSS</option>
  <option>Javascript</option>
  <!-- Using <hr/> to separate sections -->
  <hr />
  <option>ReactJs</option>
  <option>NextJs</option>
  <option>Angular</option>
</select>

See the Pen Dividing options in select tag by Preet Suthar (@preetsuthar17) on CodePen.

Did you enjoyed the post?

Twitter (x)