I'm creating a module that will display information. this information should be displayed as expandable divs, which I created using only CSS as it is here :
.news .itens {
overflow: auto;
margin-right: -20px;
height: 292px;
float: left;
width: 290px;
font-size: 65%;
}
.news .itens a {
float: left;
width: 258px;
padding: 0px 5px;
text-align: right;
height: auto;
background:rgba(168, 202, 106,0.3);
line-height: 25px;
border-right: 2px solid rgb(168, 202, 106);
margin-bottom: 2px;
font-size: 120%;
}
.news .itens p {
display:none;
float: left;
line-height: 20px;
padding: 0px 5px;
width: 248px;
border-left: 2px solid rgb(255,255,255);
background: rgb(255,255,255);
margin-bottom: 0px;
text-align: justify;
overflow:hidden;
}
.news .itens a:focus p{
display:block;
}
.news .itens a:first-child p{
display:block;
}
.news .itens a:first-child + .news .itens a:focus p{
display:none;
}
My problem is that I need to make the first element in the a:first-child
% divx close as soon as it is clicked on another existing element, and that when no element is focus
, it stays open as it is in CSS.
How could this be done?