css使用starting-style属性实现弹出层动画效果代码
代码语言:html
所属分类:弹出层
代码描述:css使用starting-style属性实现弹出层动画效果代码
代码标签: css starting-style 属性 弹出层 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> dialog{ opacity: 1; translate: 0; color: var(--clr-txt); border: 1px solid rgba(from var(--clr-primary) r g b /.25); background-color: var(--clr-bg); border-radius: 10px; max-width: 270px; padding: 1rem; text-wrap: balance; @starting-style { opacity: 0; translate: 0 100svh; } transition: opacity 300ms ease-in, translate 500ms cubic-bezier(0.28, -0.55, 0.27, 1.55); } /* Backdrop styling */ dialog[open]::backdrop { background-color: rgba(from var(--clr-secondary) r g b / .5); backdrop-filter: blur(3px); opacity: 1; @starting-style { opacity: 0; } transition: opacity 1000ms ease-in; } dialog .btn-dialog-close{ position: absolute; top: 4px; right: 4px; border-radius: 50%; background-color: rgba(from var(--clr-secondary) r g b / .5); border: none; outline: none; cursor: pointer; transition: rotate 300ms, background-color 300ms ease-in-out;; } dialog .btn-dialog-close:focus-visible, dialog .btn-dialog-close:hover{ rotate: 90deg; background-color: var(--clr-secondary); } .btn-dialog-open{ width: fit-content; margin-inline: auto; cursor: pointer; background-color: rgba(from var(--clr-secondary) r g b / .5); border: 1px solid var(--clr-secondary); border-radius: 5px; outline: none; padding: 1rem 2rem; font-size: 2rem; color: var(--clr-primary); transition: background-color 300ms ease-in-out; } .btn-dialog-open:focus-visible, .btn-dialog-open:hover{ .........完整代码请登录后点击上方下载按钮下载查看
网友评论0