css实现点击按钮右侧弹出层效果代码

代码语言:html

所属分类:弹出层

代码描述:css实现点击按钮右侧弹出层效果代码

代码标签: css 点击 按钮 右侧 弹出层

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">

  
<style>
@import url("https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,700&subset=latin");
html {
  --blue: #00427a;
  --sky: #76bbe7;
  --cloud: #eff4f9;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--sky);
  font-family: "IBM Plex Sans";
}

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

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  place-items: center;
  line-height: 1.65;
}

button {
  font-family: "IBM Plex Sans";
  border: 2px solid var(--blue);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  background: none;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

dialog {
  --t: .5s;
  --w: 50%;
  --bg: #fff;
  --easeOutBack: cubic-bezier(0.615, 1.361, 0.661, 1);
  --padding: 2rem;
  --paddingTop: 2rem;
  --bottomDrawerCornerRadius: 1.5rem;
  --padBounce: 20vmax;
  margin: 0;
  width: calc(var(--w) + var(--padBounce));
  height: 100dvh;
  border: none;
  padding: 0;
  padding-right: var(--padBounce);
  background: var(--bg);
  inset: unset;
  right: 0;
  top: 0;
  transition: all calc(var(--t) / 2) ease-in allow-discrete;
  translate: 100% 0;
}
dialog:popover-open {
  opacity: 1;
  translate: calc(var(--padBounce)) 0;
  box-shadow: 0px 1px 64px 0px rgba(0, 0, 0, 0.15);
  transition: all var(--t) var(--easeOutBack) allow-discrete;
}
@starting-style {
  dialog:popover-open {
    opacity: 0;
    translate: 100% 0;
  }
}
dialog::-webkit-backdrop {
  background: #0000;
  -webkit-transition: all calc(var(--t) / 2) allow-discrete;
  transition: all calc(var(--t) / 2) allow-discrete;
}
dialog::backdrop {
  background: #0000;
  transition: all calc(var(--t) / 2) allow-discrete;
}
dialog:popover-open::-webkit-backdrop {
  background: #0003;
}
dialog:popover-open::backdrop {
  background: #0003;
}
@starting-sty.........完整代码请登录后点击上方下载按钮下载查看

网友评论0