I've encountered a minor yet significant issue. I managed to successfully incorporate a feature that enables me to hide and expand content using custom symbols, specifically a "+" and "-". This implementation was inspired by HTML5 Doctor.
Here, you can find the code version on jsfiddle where the CSS excerpt is provided:
summary:-webkit-details-marker {
color: 000;
display: none;
font-size: 125%;
margin-right: 2px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
height: 10px;
font-size: 20px;
overflow: hidden;
}
summary:after {
background: transparent;
border-radius: 5px;
content: "+";
color: #000;
float: left;
font-size: 1.5em;
font-weight: bold;
margin: -5px 10px 0 0;
padding: 0;
text-align: center;
width: 20px;
}
details[open] summary:after {
content: "-";
}
summary:focus {
outline-style: none;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
article > details > summary {
color: transparent;
font-size: 18px;
margin-top: 16px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
details > paragraph {
margin-left: 24px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
details details {
margin-left: 36px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
details details summary {
font-size: 16px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
@keyframes fadein {
from {
opacity:0;
}
to {
opacity:1;
}
}
@-moz-keyframes fadein { /* Firefox */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-webkit-keyframes fadein { /* Safari and Chrome */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-o-keyframes fadein { /* Opera */
from {
opacity:0;
}
to {
opacity: 1;
}
}
My aim is to have another version where the expand/hide symbol aligns to the right. Despite trying this, it fails to perform as intended. The text appears early, and the symbol seems inactive. I suspect there's an error on my part, although the realignment worked.
Below is the CSS snippet from the second jsfiddle attempt:
rsummary:-webkit-rdetails-marker {
color: 000;
display: none;
font-size: 125%;
margin-left: 2px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
height: 10px;
font-size: 20px;
overflow: hidden;
}
rsummary:after {
background: transparent;
border-radius: 5px;
content: "+";
color: #000;
float: right;
font-size: 1.5em;
font-weight: bold;
margin: -5px 10px 0 0;
padding: 0;
text-align: center;
width: 20px;
}
rdetails[open] rsummary:after {
content: "-";
float: right;
}
rsummary:focus {
outline-style: none;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
rarticle > rdetails > rsummary {
color: transparent;
float: right;
font-size: 18px;
margin-top: 16px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
rdetails > rparagraph {
margin-right: 24px;
animation: fade in 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
rdetails rdetails {
margin-right: 36px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
rdetails rdetails rsummary {
font-size: 16px;
animation: fadein 3s;
-moz-animation: fadein 3s; /* Firefox */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-o-animation: fadein 3s; /* Opera */
}
@keyframes fadein {
from {
opacity:0;
}
to {
opacity:1;
}
}
@-moz-keyframes fadein { /* Firefox */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-webkit-keyframes fadein { /* Safari and Chrome */
from {
opacity:0;
}
to {
opacity:1;
}
}
@- o-keyframes fadein { /* Opera */
from {
opacity:0;
}
to {
opacity: 1;
}
}
Since I want two versions with one marker floating to the left (which is already working correctly) and one to the right, it is crucial for the right one to function as expected. Alternatively, if there's a way to display or hide the text by clicking on the banner itself rather than using a +/- symbol, I'd greatly appreciate it. This method aligns with how I envision it working, even though it requires removing the hyperlink linked to the image – not a problem. This issue has been bothering me for a couple of days now, so any assistance would be highly appreciated. Thank you.