gpt4 book ai didi

html - Safari: `all: unset;` 添加大量css规则

转载 作者:行者123 更新时间:2023-11-27 23:48:27 25 4
gpt4 key购买 nike

我有一些非常简单的 HTML,可以在 Chrome 上完美运行,但在 Safari 上却不行。根据网络检查员的说法,我的跨度应该显示绿色文本。但是它显示为黑色。

what it looks like

如您所见,名称“John”显示为黑色。但是,根据网络检查员的说法,它应该是绿色的。

web inspector

修修补补后,我发现问题出在我对 all: unset; 的使用上.出于某种原因,在使用 all: unset; 时在 <span> 的父元素之一中,计算出的 CSS 规则来自:

box-sizing: border-box;
color: rgb(9, 112, 19);
display: inline;
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
height: auto;
line-height: 25px;
pointer-events: auto;
width: auto;

-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-box-direction: normal;
-webkit-cursor-visibility: auto;
-webkit-font-kerning: auto;
-webkit-font-smoothing: auto;
-webkit-hyphenate-character: auto;
-webkit-hyphenate-limit-after: auto;
-webkit-hyphenate-limit-before: auto;
-webkit-hyphenate-limit-lines: no-limit;
-webkit-hyphens: manual;
-webkit-line-align: none;
-webkit-line-box-contain: block inline replaced;
-webkit-line-grid: none;
-webkit-line-snap: none;
-webkit-locale: en-US;
-webkit-nbsp-mode: normal;
-webkit-print-color-adjust: economy;
-webkit-rtl-ordering: logical;
-webkit-text-combine: none;
-webkit-text-decoration-line: none;
-webkit-text-decorations-in-effect: none;
-webkit-text-emphasis-color: rgb(0, 0, 0);
-webkit-text-emphasis-position: over right;
-webkit-text-emphasis-style: none;
-webkit-text-fill-color: rgb(0, 0, 0);
-webkit-text-orientation: mixed;
-webkit-text-security: none;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-color: rgb(0, 0, 0);
-webkit-text-stroke-width: 0px;
-webkit-user-modify: read-only;
-webkit-user-select: text;
border-collapse: separate;
box-sizing: border-box;
caption-side: top;
clip-rule: nonzero;
color: rgb(9, 112, 19);
color-interpolation: sRGB;
color-interpolation-filters: linearRGB;
color-rendering: auto;
cursor: auto;
display: inline;
empty-cells: show;
fill: rgb(0, 0, 0);
fill-opacity: 1;
fill-rule: nonzero;
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-optical-sizing: auto;
font-size: 13px;
font-style: normal;
font-synthesis: style weight small-caps;
font-variant-numeric: normal;
font-weight: normal;
glyph-orientation-horizontal: 0deg;
glyph-orientation-vertical: auto;
hanging-punctuation: none;
height: auto;
image-rendering: auto;
kerning: 0;
letter-spacing: normal;
line-height: 25px;
list-style-image: none;
list-style-position: outside;
list-style-type: disc;
marker-end: none;
marker-mid: none;
marker-start: none;
orphans: auto;
overflow-wrap: normal;
pointer-events: auto;
resize: none;
shape-rendering: auto;
stroke: none;
stroke-dasharray: none;
stroke-dashoffset: 0px;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-opacity: 1;
stroke-width: 1px;
tab-size: 8;
text-align: start;
text-anchor: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
text-shadow: none;
text-transform: none;
visibility: visible;
white-space: normal;
widows: auto;
width: auto;
word-break: normal;
word-spacing: 0px;
word-wrap: normal;
writing-mode: horizontal-tb;

这是不希望的,因为使用 all: unset; 的目的是是删除该元素的所有现有 CSS 规则。原因是它覆盖在现有网站之上,因此可以从基础网站继承 CSS 规则。我用 all: unset;以避免底层网站 CSS 规则干扰此应用程序。

如果我简单地添加 -webkit-text-fill-color: #097013;根据我的 CSS 规则,它将按预期工作。 但我不明白为什么要添加all: unset;添加了如此多的 CSS 规则,而它的目的是删除它们。

最佳答案

在研究了“全部”规则的“未设置”属性的工作原理后,我的假设似乎是错误的。 According to W3 :

unset - Changes all the properties applied to the element or the element's parent to their parent value if they are inheritable or to their initial value if not

关于html - Safari: `all: unset;` 添加大量css规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56659485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com