存在替换的可能性
<details>
元素,这在例如。
Can I replace the expand icon (▶) of the <details> element?
以及答案
https://stackoverflow.com/a/10813665/1657886
通常情况下
<详细信息>
元素将具有
<summary>
一切都很好,但当
<摘要>
元素丢失时,浏览器将返回到默认文本“详细信息”和默认图标。
CSS代码在存在
<摘要>
元素存在:
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%;
}
问题是如何设置图标,以防
<摘要>
元素丢失?
编辑
完整示例(文件名: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>