The possibility exists to replace the replace the expand macro of the <details>
element, this is described in e.g. Can I replace the expand icon (▶) of the <details> element? and the answer https://stackoverflow.com/a/10813665/1657886
Normally the <details>
element will have a <summary>
in it and all works fine, but when the <summary>
element is missing the browser will fall back to the default text "Details" and the default icon.
CSS code working in case there is a <summary>
element present:
details>summary {
list-style-type: none;
}
details > summary::-webkit-details-marker {
display: none;
}
details>summary::before {
content: "\25ba";
padding-right:4px;
font-size: 80%;
}
details[open]>summary::before {
content: "\25bc";
padding-right:4px;
font-size: 80%;
}
The question is how to set the icon in case the <summary>
element is missing?
Edit Full example (file name: aa.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<title>My Project</title>
<style>
details>summary {
list-style-type: none;
}
details > summary::-webkit-details-marker {
display: none;
}
details>summary::before {
content: "\25ba";
padding-right:4px;
font-size: 80%;
}
details[open]>summary::before {
content: "\25bc";
padding-right:4px;
font-size: 80%;
}
</style>
</head>
<body>
<details >
<summary> The summary 1</summary> The details 1
</details>
<details >
The details no own summary
</details>
</body>
</html>