optgroup !?

wieder ich :P

Code:
<select>
<optgroup label="Cat1">
<optgroup label="Sub1cat1">
<option>blaa</option>
<option>gna</option>
</optgroup>
<optgroup label="Sub2cat1">
<option>blaa</option>
<option>gna</option>
</optgroup>
</optgroup>
<optgroup label="Cat2">
<optgroup label="Sub1cat2">
<option>blaa</option>
<option>gna</option>
</optgroup>
<optgroup label="Sub2cat2">
<option>blaa</option>
<option>gna</option>
</optgroup>
</optgroup>
</select>

nen bild ist im anhang...

ist es irgendwie möglich das ich die "Subcats" auch noch einrücken kann? hab schon diverses unter css und so probiert, aber bisher nich das richtige erwischt xD

PS: googleln brachte mich bisher noch ned weiter oO
 
Vlt. gibt es einen Workaround zu deinem Problem, aber ansich darf innerhalb einer <optgroup> kein zweites <optgroup> vorkommen, wodurch eine tiefere Verschachtelung nicht möglich bzw. zumindest nicht (x)html konform ist.
 
Naja dann machs halt von Hand mit erzwungenen Leerzeichen...
Is zwar net grad ne Vorzeigelösung, aber solange es funktioniert... ^^

Code:
<select>

<optgroup label="Cat1"></optgroup>
<optgroup label="  Sub1cat1">
      <option>  blaa</option>
      <option>  gna</option>
</optgroup>
<optgroup label="  Sub2cat1">
      <option>  blaa</option>
      <option>  gna</option>
</optgroup>

<optgroup label="Cat2"></optgroup>
<optgroup label="  Sub1cat2">
      <option>  blaa</option>
      <option>  gna</option>
</optgroup>
<optgroup label="  Sub2cat2">
      <option>  blaa</option>
      <option>  gna</option>
</optgroup>

</select>
 
Original aus der W3C-Spezifikation
Note. Implementors are advised that future versions of HTML may extend the grouping mechanism to allow for nested groups (i.e., OPTGROUP elements may nest). This will allow authors to represent a richer hierarchy of choices.
Das W3C ist sich der Problematik also durchaus bewusst ;)
 
Zurück
Oben