<h1>Optgroup example</h1>

<form>
<label for="positions">Applying for Position:</label>
<select name="positions">
 <optgroup label="HR Department">
    <option value="hrmanager">HR Manager</option>
    <option value="hrspecialist" selected>HR Specialist</option>
</optgroup>
 <optgroup label="Marketing Department">
<option value="smanager" selected>Social Media Manager</option>
<option value="mspecialist" selected>Marketing Specialist</option>
</optgroup>
</select> 
</form>
*{font-family: arial}

body {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

h1 {
  text-align: center;
}

form {
  max-width: 500px;
  padding: 20px;
  box-shadow: 0px 0px 16px 4px rgba(0,0,0,0.1)
}


label {
  margin: 0 0 4px 0;
}

select {
  padding: 4px 10px;
  font-size: 16px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.