Solution du problème
Je suggérerais d'utiliser la :is()
syntaxe - relativement nouvelle - :
*,
::before,
::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
border: 0.3em solid rebeccapurple;
margin-block: 1em;
margin-inline: auto;
width: clamp(30em, 50vw, 600px);
}
.container:is(h3, p) {
border: 1px solid #000;
color: rebeccapurple;
margin-block: 1em;
margin-inline: auto;
padding-inline: 1em;
width: 80%;
}
<h3>A <h3> element, that should probably be a <h2></h3>
<div class="container">
<h3>A properly-used, and selected, <h3> element</h3>
<p>...and an adjacent <p> element.</p>
</div>
<p>Some text in a paragraph that shouldn't be styled.</p>
Aucun commentaire:
Enregistrer un commentaire