Skip to content

[css-content] Clearer syntax for alternative text for content #3899

@dot-miniscule

Description

@dot-miniscule

The spec states that alternative text can be supplied for CSS generated content with the following syntax:

.new::before {
 content: url(./img/star.png) / "New!";
}

While there is developer support for this feature, it is not obvious to the content author what the purpose of the alt text declared in style is for. This has led to the suggestion that wrapping the alternative text it in alt() would make the intended purpose much more obvious and meaningful:

.new::before {
 content: url(./img/star.png) / alt("New!");
}

It looks like this was originally discussed/considered, and it would be good to revisit this. I was unable to find any specific justifications as to why the alt() syntax was passed over in favor of what's in the spec so I'd just like to open it up to discussion now. Depending on the outcome of discussion, I'd be happy to draft a PR on the spec to update the syntax.

Concerns from TAG review of this syntax can be seen here: https://lists.w3.org/Archives/Public/www-style/2016May/0109.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions