css固定水平垂直居中对齐弹出层效果代码

代码语言:html

所属分类:弹出层

代码描述:css固定水平垂直居中对齐弹出层效果代码

代码标签: 垂直 居中 对齐 弹出 效果

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


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

<head>

 
<meta charset="UTF-8">

 
<style>
#new:checked ~ .popup {
  /* Center styles */
  inset: 0;
  margin: auto;
  /* End Center styles */
}

#old:checked ~ .popup {
  /* Center styles */
  left: 50%;
  top: 50%;
  transform: translatex(-50%) translatey(-50%);
  /* End Center styles */
}

#new:checked ~ .popup .popup-title::before {
  content: "新的 ";
}
#new:checked ~ .popup .code::before {
  content: ".popup { \a   position: fixed; \a   inset: 0; \a   margin: auto; \a\a   width: fit-content; \a   height: fit-content; \a}";
  white-space: pre;
}

#old:checked ~ .popup {
  border-color: #8bc34a;
}
#old:checked ~ .popup .popup-title::before {
  content: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0