css 如何删除摘要元素侧面的箭头

lfapxunr  于 2023-03-14  发布在  其他
关注(0)|答案(3)|浏览(114)

我在details元素中有一个摘要:

<details>
  <summary>Hello</summary>
</details>

我试过:

summary {
  display: block; /* works in firefox */
  list-style: none; /* works in firefox */
}

/* didn't work in any browser */
summary::marker,
summary::-webkit-details-marker {
  display: none;
}

/* Solution for Chrome and Safari? */

从这个问题How can you hide the arrow that is displayed by default on the HTML5 element in Chrome?
但这些解决方案中没有一个能在chrome上真正起作用。
我如何删除这个箭头在 chrome 呢?

8mmmxcuj

8mmmxcuj1#

这对我有用!

summary::marker {
  content: "";
}
bnlyeluc

bnlyeluc2#

summary {
  &::marker {
    content: "";
  }
}
ruyhziif

ruyhziif3#

<!DOCTYPE html>
    <html>

    <head>
        <title>Page Title</title>
        <style>
            summary {
                display: block;
                /* works in firefox */
                list-style: none;
                /* works in firefox */
            }

            summary::after {
                display: block;
                list-style: none;
            }

            summary::-webkit-details-marker {
                display: none;
            }
        </style>
    </head>

    <body>

        <details>
            <summary>Hello</summary>
        </details>

    </body>

    </html>

相关问题