Skip to content

[css-pseudo] Extending the scope of ::placeholder #13345

@Crissov

Description

@Crissov

The prose for ::placeholder currently clearly limits its use to placeholders that eventually get replaced by user input, i.e. within form widgets. Conceptually, I think it could equally apply to “alternative” text that is displayed instead of replaced elements when their replaced content cannot (yet) be rendered – most notably the alt attribute of <img> elements in HTML. Although there have been pseudo-classes proposed to select such elements #3134, there currently does not seem to be a way to select and style only this kind of placeholder (unless it comes from a descendant element instead of an attribute in the host document language, e.g. within <audio>, <video> or <object>).

  • Should the scope of ::placeholder be broadened to include alternative text?
  • In case it shan’t, should a new pseudo-element be introduced to represent alternative text?
    • Would a combination of pseudo-element and (new) pseudo-classes, e.g. ::content:textual vs. ::content:replaced, yield more useful options for authors?
      (Even though its scope is different, this should be considered together with the longstanding ::text proposal. [css-pseudo-5] ::text / ::text-node pseudoelement #2208)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions