css实现一个模态弹出层弹框效果代码
代码语言:html
所属分类:弹出层
代码描述:css实现一个模态弹出层弹框效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"); html { box-sizing: border-box; } *, *:before, *:after { box-sizing: border-box; } body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; background-color: #f9fafb; font-size: 70%; line-height: 1.4; font-family: "Inter", sans-serif; color: #6b7280; font-weight: 400; } @media only screen and (min-width: 600px) { body { justify-content: center; align-items: center; display: flex; height: 100vh; font-size: 100%; } } .button { -webkit-appearance: none; -moz-appearance: none; appearance: none; background: #16a34a; border-radius: 0.25em; color: white; cursor: pointer; display: inline-block; font-weight: 500; height: 3em; line-height: 3em; padding: 0 1em; } .button:hover { background-color: #17ac4e; } .details-modal { background: #ffffff; border-radius: 0.5em; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); left: 50%; max-width: 90%; pointer-events: none; position: absolute; top: 50%; transform: translate(-50%, -50%); width: 30em; text-align: left; max-height: 90vh; display: flex; flex-direction: column; } .details-modal .details-modal-close { align-items: center; color: #111827; display: flex; height: 4.5em; justify-content: center; pointer-events: none; position: absolute; right: 0; top: 0; width: 4.5em; } .details-modal .details-modal-close svg { display: block; } .details-modal .details-modal-title { color: #111827; padding: 1.5em 2em; pointer-events: all; position: relative; width: calc(100% - 4.5em); } .details-modal .details-modal-title h1 { font-size: 1.25rem; font-weight: 600; line-height: normal; } .details-modal .details-modal-content { border-top: 1px solid #e0e0e0; padding: 2em; pointer-events: all; overflow: auto; } .details-modal-overlay { transition: opacity 0.2s ease-out; pointer-events: none; background: rgba(15, 23, 42, 0.8); position: fixed; opacity: 0; bottom: 0; right: 0; left: 0; top: 0; } details[open] .details-modal-overlay { pointer-events: all; opacity: 0.5; } details summary:focus { outline: none; } details summary::-webkit-details-marker { display: none; } code { font-family: Monaco, monospace; line-height: 100%; background-color: #2d2d2c; padding: 0.1em 0.4em; letter-spacing: -0.05em; word-break: normal; border-r.........完整代码请登录后点击上方下载按钮下载查看
网友评论0