强制 <summary> 表现得像 display:inline 而不是 inline-block
Force <summary> to behave as display:inline instead of inline-block
我想将 <details>
/ <summary>
标签用于纯 CSS 弹出窗口,但 <summary>
表现为内联块,我无法将其更改为内联.
有什么方法可以强制 <summary>
表现得像 display:inline 而不是内联块?
<!DOCTYPE html>
<html>
<head>
<style>
summary {
color: red;
}
summary::-webkit-details-marker {
display: none;
}
details, summary {
display: inline;
/* hyphens: manual;/ */
/* word-break: break-all; */
/* overflow-wrap: anywhere; */
/* white-space: unset; */
}
.mimic {
color: darkseagreen;
display: inline-block;
}
</style>
</head>
<body>
<span>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<details>
<summary>
but <summary> behaves as inline-block
</summary>
(I'm fine with <details>)
</details>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<br><br>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<span class="mimic">
but <summary> behaves as inline-block
</span>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<p>
Just start to play with the width of the viewport...
</p>
</span>
</body>
</html>
display: contents;
可以做到,但它会表现得很奇怪:
summary {
color: red;
}
summary::-webkit-details-marker {
display: none;
}
details,
summary {
display: contents;
/* hyphens: manual;/ */
/* word-break: break-all; */
/* overflow-wrap: anywhere; */
/* white-space: unset; */
}
.mimic {
color: darkseagreen;
display: inline-block;
}
<span>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<details>
<summary>
but <summary> behaves as inline-block
</summary>
(I'm fine with <details>)
</details>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<br><br>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<span class="mimic">
but <summary> behaves as inline-block
</span> and I cannot change it to inline. Is there any way to force <summary> to behave as display:inline instead of inline-block?
<p>
Just start to play with the width of the viewport...
</p>
</span>
我想将 <details>
/ <summary>
标签用于纯 CSS 弹出窗口,但 <summary>
表现为内联块,我无法将其更改为内联.
有什么方法可以强制 <summary>
表现得像 display:inline 而不是内联块?
<!DOCTYPE html>
<html>
<head>
<style>
summary {
color: red;
}
summary::-webkit-details-marker {
display: none;
}
details, summary {
display: inline;
/* hyphens: manual;/ */
/* word-break: break-all; */
/* overflow-wrap: anywhere; */
/* white-space: unset; */
}
.mimic {
color: darkseagreen;
display: inline-block;
}
</style>
</head>
<body>
<span>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<details>
<summary>
but <summary> behaves as inline-block
</summary>
(I'm fine with <details>)
</details>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<br><br>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<span class="mimic">
but <summary> behaves as inline-block
</span>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<p>
Just start to play with the width of the viewport...
</p>
</span>
</body>
</html>
display: contents;
可以做到,但它会表现得很奇怪:
summary {
color: red;
}
summary::-webkit-details-marker {
display: none;
}
details,
summary {
display: contents;
/* hyphens: manual;/ */
/* word-break: break-all; */
/* overflow-wrap: anywhere; */
/* white-space: unset; */
}
.mimic {
color: darkseagreen;
display: inline-block;
}
<span>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<details>
<summary>
but <summary> behaves as inline-block
</summary>
(I'm fine with <details>)
</details>
and I cannot change it to inline. Is there any way to force <summary>
to behave as display:inline instead of inline-block?
<br><br>
I would like to use the <details> / <summary> tags for
pure CSS popups,
<span class="mimic">
but <summary> behaves as inline-block
</span> and I cannot change it to inline. Is there any way to force <summary> to behave as display:inline instead of inline-block?
<p>
Just start to play with the width of the viewport...
</p>
</span>