0
div.duvidas2 > div > div::active +
div.duvidas2 > div > article {
display: block;
}
div.duvidas2 > div > article {
display: none;
}
<div class=duvidas2>
<div>
<div>
<span>Titulo 1</span>
<label>+</label>
</div>
<article>Artigo 1.</article>
</div>
<div>
<div>
<span>Titulo 2</span>
<label>+</label>
</div>
<article>Artigo 2.</article>
</div>
</div>
My goal is to click on div.duvidas2 > div
and open the article
But only the article
of div.duvidas2 > div
that is active must be with display:block
Where am I going wrong?
About :: is CSS3 rule. : it was only in CSS2. But in the case of hugocsl, is there a way, by clicking the same link, to close it too? Type: opened, clicked again and closed. This with CSS? Or in this case only with JS? But I understood your explanation. But the link shows an example with input type text https://jsfiddle.net/zsderorm/1/
– Carlos Rocha
@Carlosrocha not young, does not exist
::active
nowhere, here you can check a reliable documentation and will see that there is no mention to::active
, the::
are for pseudo-elements, not for pseudo-classes see https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes this example of the link you posted uses:focus
like the example I left there in the answer. The way you want to do it, but the technique is different, is using checkbox and label. Or you can do as in this question https://answall.com/questions/360001/como-customizar-a-seta-padr%C3%a3o-da-tag-Details– hugocsl
got it! In that case, doing it with Javascript or Jquery will get better! But thank you very much. I will accept the answer as it was fully compatible with the question!
– Carlos Rocha
@Carlosrocha haha because you asked where you were going wrong right rss. But to solve there are several techniques, some yes with JS/jQuery, but you can also do with html/css, look for "Collapse Component" in Google you will find some things. This other question may interest you there are some tips there https://answall.com/questions/182123/como-fazer-collapse-e-expand-de-um-texto-usando-apenas-html5
– hugocsl