8000 Disabled labels `label:disabled` · Issue #4524 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

Disabled labels label:disabled #4524

@MartijnCuppens

Description

@MartijnCuppens

Is there any possibility labels which refer to a disabled input (or any form control like select, textarea, ect...) can have additional styling applied to?

For example:
HTML:

<!-- Normal label: -->
<div>
  <label for="test">Label</label>
  <input type="checkbox" id="test">
</div>

<!-- This disabled label can be styled with a sibling selector: -->
<div>
  <input type="checkbox" id="test2" disabled>
  <label for="test2">Label</label>
</div>

<!-- This disabled label can not be styled in CSS: -->
<div>
  <label for="test3">Label</label>
  <input type="checkbox" id="test3" disabled>
</div>

<!-- This disabled label can not be styled in CSS: -->
<label>
  <span>Label</label>
  <input type="checkbox" disabled>
</label>

CSS:

input:disabled {
  /* Styling for disabled input, this currently works */
}

label:disabled {
  /* Styling for label referring to a disabled input, this currently doesn't works */
}

So my proposal is to add a disabled state for labels, like described in the CSS block above. Let me know if I'm missing something here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0