I am trying to vertically align the arrow that comes with the
the second line of
You could implement your own foldable system. But the best way is to hack the details and summary elements a bit by removing the default arrow and placing a new one with the :before pseudo selector.
start off by hiding the default arrow:
summary::-webkit-details-marker {
display: none;
}
then add your own arrows with the content property
closed:
summary:before {
content: "►";
}
opened:
details[open] summary:before {
content: "▼";
}
add a wrapping div element for our summary's text:
Now our structure looks like:
::before
Show more, you can click here on the summary's label to fold down the hidden menu
we need to align the ::before element with the div element:
set some width and margin to summary:before
set summary > div's display to inline-block to align the two blocks
let summary > div have the remaining horizontal space by using the CSS function calc:
summary > div {
width: calc(100% - 50px); /* 50px is the space taken by summary::before */
}
to align the two blocks horizontally simply set vertical-align to middle
summary::-webkit-details-marker {
display: none
}
summary > div {
width: calc(100% - 50px);
display: inline-block;
vertical-align: middle;
}
details {
font-size: 20px;
}
summary {
display: block
}
summary:before {
content: "►";
margin: 0px 10px 0 0;
width: 20px;
}
details[open] summary:before {
content: "▼";
}
Show more, you can click here on the summary's label to fold down the hidden menu
Nothing to see here.
This is actually an even bigger summary text, and it works! The arrow on the left is perfectly positioned. Show more, you can click here on the summary's label to fold down the hidden menu
Nothing to see here.