简体   繁体   English

iOS Safari 中的轮廓渲染错误

[英]Outline rendering Bug in iOS Safari

Safari on iOS 14 and probably below has a bug with the outline of the summary tag. iOS 14 上的 Safari 和下面可能存在摘要标签轮廓的错误。

If I open the details tag it will break the line:如果我打开详细信息标签,它将打破这一行: iOS大纲错误

And the same thing in Edge Chromium:在 Edge Chromium 中也是如此: 在此处输入图像描述

I tried setting the width and height of the "icon" in order to reduce the box to the minimum but unfortunately that does not work.我尝试设置“图标”的宽度和高度以将框减小到最小,但不幸的是这不起作用。

Here is a link to the website: https://live.spardasurfsafe-bw.de/这是网站的链接: https://live.spardasurfsafe-bw.de/

Here is a code snipped with the used css:这是使用 css 截取的代码:

 summary { margin-bottom: 1rem; position: relative; } summary::marker, summary::-webkit-details-marker { color: transparent; } summary::after { content: "+"; position: absolute; font-size: 2em; top: -.3em; margin-left: 10px; transition: all 0.5s; } details[open] summary::after { transform: translate(5px,0) rotate(45deg); }
 <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details>

It seems that Safari renders pseudo elements not inline as the other browsers.似乎 Safari 呈现的伪元素不像其他浏览器那样内联。 It can almost reproduced in Chromium browsers with display: inline-block;它几乎可以在带有display: inline-block; on the pseudo-element and removing position: absolute :在伪元素上并删除position: absolute

 summary { margin-bottom: 1rem; position: relative; } summary::marker, summary::-webkit-details-marker { color: transparent; } summary::after { content: "+"; font-size: 2em; position: relative; top: 5px; margin-left: 10px; transition: all 0.5s; display: inline-block; line-height: 0; } details[open] summary::after { transform: translate(5px,0) rotate(45deg); }
 <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details>

In order to fix this issue all I had to do was to restrict the overflow for the "parent" element (summary overflow: hidden; ):为了解决这个问题,我所要做的就是限制“父”元素的溢出(摘要overflow: hidden; ):

 summary { margin-bottom: 1rem; position: relative; overflow: hidden; } summary::marker, summary::-webkit-details-marker { color: transparent; } summary::after { content: "+"; font-size: 2em; position: relative; top: 5px; margin-left: 10px; transition: all 0.5s; display: inline-block; line-height: 0; } details[open] summary::after { transform: translate(5px,0) rotate(45deg); }
 <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details> <details> <summary>foo</summary> <ul> <li>bar</li> <li>baz</li> </ul> </details>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM