首页 > 解决方案 > 大纲只能使用焦点修改

问题描述

我有一个动画:尝试安装,但outline:none可能是它不起作用的原因。来自 css 的错误消息:outlines should only be modified using focus.当页面上应该有一个电灯开关时,目前只有一个带有文本的灰色页面:https ://adsler.co.uk/privacy-policy/ 。可能不是那样,而是试图打折所有选项,它被列为 css 错误。

CSS:

*,
*::before,
*::after {
box-sizing: border-box;
}

body,
html {
height: 100%;
font-weight: 500px;
font-family: 'Titillium Web', sans-serif;
background: #eee;
}

[type="checkbox"] {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: all .05s ease-in-out;
width: 80px;
height: 110px;
z-index: 2;
opacity: 0.001;
cursor: pointer;
-webkit-appearance: none;
-webkit-tap-highlight-color: transparent;
outline: none;
}

[type="checkbox"] ~ .switch {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: all .05s ease-in-out;
width: 80px;
height: 110px;
border-radius: 12px;
background: linear-gradient(to bottom, #d2d4d6, #fff);
box-shadow: inset 0 -2px 4px rgba(212, 205, 199, 0.75), 
          inset 0 -8px 0 1px rgba(156, 156, 157, 0.85), 
          0 0 0 1px rgba(116, 116, 118, 0.8), 
          0 6px 6px rgba(41, 41, 41, 0.3), 
          0 0 0 4px #d4d7d8;
filter: contrast(1);
}

[type="checkbox"] ~ .switch::before, 
[type="checkbox"] ~ .switch::after {
content: 'on';
position: absolute;
left: 0;
bottom: 11px;
color: rgba(0, 0, 0, 0.5);
font-size: 20px;
width: 100%;
text-align: center;
text-transform: uppercase;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
transition: all .05s ease-in-out;
}

[type="checkbox"] ~ .switch::after {
content: 'off';
bottom: auto;
top: 5px;
color: rgba(0, 0, 0, 0.45);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

[type="checkbox"]:checked ~ .switch {
background: linear-gradient(to bottom, #a1a2a3, #f0f0f0);
box-shadow: inset 0 2px 4px rgba(212, 205, 199, 0.75), 
          inset 0 8px 0 1px rgba(255, 255, 255, 0.77), 
          0 0 0 1px rgba(116, 116, 118, 0.8), 
          0 -2px 2px rgba(41, 41, 41, 0.18), 
          0 0 0 4px #d4d7d8;
filter: none;
}

[type="checkbox"]:checked ~ .switch::before {
bottom: 3px;
color: rgba(0, 0, 0, 0.5);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

[type="checkbox"]:checked ~ .switch::after {
top: 13px;
color: rgba(0, 0, 0, 0.45);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
}

[type="checkbox"] ~ .light {
background: #0a0a16;
opacity: 0.7;
top: 0;
left: 0;
width: 100%;
height: 100%;
mix-blend-mode: multiply;
pointer-events: none;
z-index: 2;
}

[type="checkbox"]:checked ~ .light {
opacity: 0;
}

html:

<input type="checkbox" 
checked="checked" />
<div class="switch"></div>
<div class="light"></div>

unknown property得到mix-blend-mode

标签: htmlcsswordpressanimation

解决方案


推荐阅读