Skip to content

Unexpected behaviour selecting <picture> element #3818

Closed
@MelvinIdema

Description

@MelvinIdema

Issue

The <picture> element is doing nothing, only providing context for the browser. So the expected behaviour should be that it's being treated as an img element. This is the case using the Descendant Selector. But as soon as a selector other than the Descendant Selector is introduced this is no longer the case and CSS won't select the picture anymore.

Examples

1. Descendant Selector
A <picture> with a <div> as parent and a Descendant Selector:
https://codepen.io/melvinidema/pen/WWpBjp

2. Selector other than Descendant
A <picture> with a <div> as parent and a selector other Descendant Selector:
https://codepen.io/melvinidema/pen/zXZdKw

Expected Behaviour

The expected behaviour would be to have CSS treating the <picture> as a whole as if it was an <img>. As the <picture> and the <source> are only providing context. This is already the case using the Descendant Selector [space] as seen in the first example.

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