css实现accent-color显示两种不同风格的input效果代码
代码语言:html
所属分类:表单美化
代码描述:css实现accent-color显示两种不同风格的input效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @property --hue { initial-value: 0; syntax: '<number>'; inherits: false; } .animated .accented { -webkit-animation: rainbow calc(var(--speed, 1) * 1s) infinite linear; animation: rainbow calc(var(--speed, 1) * 1s) infinite linear; -webkit-animation-play-state: var(--animated, paused); animation-play-state: var(--animated, paused); } @-webkit-keyframes rainbow { 0% { --hue: 0; } 100% { --hue: 360; } } @keyframes rainbow { 0% { --hue: 0; } 100% { --hue: 360; } } .animated .accented { accent-color: hsl(var(--hue) calc(var(--saturation-light, 80) * 1%) calc(var(--lightness-light, 30) * 1%)); } .animated [color-scheme="dark"] .accented { accent-color: hsl(var(--hue) calc(var(--saturation-dark, 80) * 1%) calc(var(--lightness-dark, 80) * 1%)); } .accented { accent-color: hsl(var(--huey-light) calc(var(--saturation-light, 80) * 1%) calc(var(--lightness-light, 30) * 1%)); } [color-scheme="dark"] .accented { accent-color: hsl(var(--huey-dark) calc(var(--saturation-dark, 80) * 1%) calc(var(--lightness-dark, 80) * 1%)); } fieldset input { --size: 2rem; block-size: var(--size); inline-size: var(--size); } label { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; } [color-scheme="light"] { color-scheme: light; background: hsl(0, 100%, 100%); } [color-scheme="dark"] { color-scheme: dark; } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0