如何从详情元素中删除项目符号?

huangapple go评论73阅读模式
英文:

How to remove bullet from details element?

问题

我想要移除出现在 <details> 元素左侧的小箭头,但我不知道如何做到。

有人可以告诉我如何做吗?

谢谢

(顺便说一下,我确信通过编辑 CSS 样式可以轻松实现这一点)

英文:

I'm wanting to remove the little arrow that appears on the left of &lt;details&gt; element, but I don't find how to..

Can anyone tell me how to do this ?

Thanks

(btw I'm sure that it's makeable easily by editing css styling)

答案1

得分: 3

MDN的details元素文章说:

**<summary>元素支持list-style简写属性及其分解属性,例如list-style-type,可用于更改披露三角形的样式,您可以选择使用list-style-image(通常)。例如,我们可以通过设置list-style: none来移除披露小部件图标。

但是,Chrome尚不支持此功能,因此我们还需要使用其非标准的::-webkit-details-marker伪元素来自定义在该浏览器中的外观。

因此,使用list-style-type属性和::-webkit-details-marker伪元素。

summary {
  list-style-type: none; /* Firefox */
}

summary::-webkit-details-marker {
  display: none; /* Chrome */
}
<details>
  <summary>Summary</summary>
  <p>文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本。</p>
</details>
英文:

The MDN's details element article says:

> The &lt;summary&gt; element supports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). For example, we can remove the disclosure widget icon by setting list-style: none.
>
> Chrome doesn't support this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in that browser.

Therefore, use list-style-type property and ::-webkit-details-marker pseudo element.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

summary {
  list-style-type: none; /* Firefox */
}

summary::-webkit-details-marker {
  display: none; /* Chrome */
}

<!-- language: lang-html -->

&lt;details&gt;
  &lt;summary&gt;Summary&lt;/summary&gt;
  &lt;p&gt;text text text text text text text text text text text text text text text text text text text.&lt;/p&gt;
&lt;/details&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2020年1月6日 18:39:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/59610602.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定