How to style the arrow of details summary elements?
The :hover
should be on the details
tag (not the summary
).
Try this, it will work:
details:hover summary::-webkit-details-marker:hover {
color:red;
background:white;
}
Styling the HTML5 summary arrow for Firefox
Currently on FF 68 I am able to customise the marker by doing:
summary::marker {
color: red;
}
Make sure to try to apply the styles in a generic way (AKA avoid nesting classes so you are sure that the traverse is not a problem)
Also, as you probably are adding styles cross browser the below snippet doesn't work properly
summary::marker,
summary::-webkit-details-marker {
color: $primary;
}
Instead I have to define it separately like so:
summary::marker {
color: $primary;
}
summary::-webkit-details-marker {
color: $primary;
}
How can you hide the arrow that is displayed by default on the HTML5 details element in Chrome?
I didn't plan to answer my own question but I have the solution.
- Source:
http://trac.webkit.org/timeline?from=2011-04-15T16%3A33%3A41-0700&precision=second - More about the recommendation for the disclosure widget:
http://mail-archive.com/whatwg@lists.whatwg.org/msg26129.html
Code
details summary::-webkit-details-marker {
display:none;
}
Note that the disclosure widget will still be displayed if you don't provide a summary element, which is allowed by the spec.
Can I replace the expand icon (▶) of the details element?
Since <summary>
has display: list-style
, customising the disclosure marker can be done by setting the list-style-type
property:
details > summary {
list-style-type: '▶️';
}
details[open] > summary {
list-style-type: '';
}
details {
border: 1px solid gray;
border-radius: 0.2rem;
padding: 0.5rem;
}
details[open] > summary {
margin-bottom: 0.5rem;
}
<details>
<summary>An example</summary>
With some example text shown when expanded.
</details>
details and summary: delete or hide arrow
<!DOCTYPE html>
<html lang="ru">
<head>
<style>
summary{
display: inline;
{
</style>
</head>
<body>
<details>
<summary>
<div">menu1</div>
</summary>
<div>
link or image or submenu
</div>
</details>
<br><br>
!!! I'm not sure that all browsers will correctly accept such code.
<br><br>
I did this on my site.
</body>
</html>
How to properly position the arrow in details CSS
use :before
instead of :after
summary::-webkit-details-marker { display: none} summary:before { content: "+"; color: red; float: left; margin-right: 10px; }
details[open] summary:before { content: "-"; }
<details> <summary>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut gravida iaculis arcu, et hendrerit arcu. Morbi rhoncus ex quam, quis. </summary> Content goes here.</details>
Remove arrow from the summary HTML
You can get it to go away by changing the CSS attribute of the marker to not be displayed. So the arrow goes by the name of details-marker and we set its display:none
which stops it from being drawn in.
EDIT: I added in a bit of code to stop the <summary>
from highlighting blue on click, i thought it was ugly so i fixed it.
<style>summary:focus {outline:none !important}details > summary::-webkit-details-marker {display:none;}</style><center><h1>PASCAL LOTA</h1><details> <summary><img src="https://1.bp.blogspot.com/-Gqx6lkmLq_k/XoiKBHj5L9I/AAAAAAAAAi8/gohuLTm_RI8mHLSn5acQTeonA7RYSGyrwCLcBGAsYHQ/s1600/System%2Brequirements.png" /></summary> - by Refsnes Data. All Rights Reserved.<br />
All content and graphics on this web site are the property of the company Refsnes Data.<br />
</details></center>
Related Topics
How to Define a Dynamic Mixin or Function Name in Sass
Jenkins Content Security Policy
How to Horizontal & Vertical Center a Div
Convert Embedded Svg to Png In-Place
Why Is Box-Sizing Acting Different on Table Vs Div
Stripping Out HTML Tags from a String
<Div> into a <Tr>: Is It Correct
Difference Between Onblur and Onchange Attribute in HTML
Content Url Is Not Working in Firefox
Conditional Rendering of Non-Jsf Components (Plain Vanilla HTML and Template Text)
How Are 'Display: Table-Cell' Widths Calculated
Removing Space at The Top Left and Right of Div
How to Create a Triangle in CSS3 Using Border-Radius