博主信息
博文 19
粉丝 0
评论 0
访问量 16215
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
模态框 flex grid
可乐
原创
595人浏览过

模态框

  1. <style>
  2. * {
  3. padding: 0;
  4. margin: 0;
  5. user-select: none;
  6. box-sizing: border-box;
  7. }
  8. body {
  9. display: flex;
  10. justify-content: center;
  11. align-items: center;
  12. height: 100vh;
  13. }
  14. button {
  15. outline: 0;
  16. width: 150px;
  17. height: 60px;
  18. color: rgb(89, 89, 233);
  19. border-radius: 6px;
  20. border: 2px solid rgb(43, 238, 205);
  21. background-color:rgb(209, 183, 183);
  22. transition: all 0.3s;
  23. cursor: pointer;
  24. }
  25. button:hover {
  26. color:rgb(247, 233, 233);
  27. border-color: rgb(126, 126, 192);
  28. background-color: rgb(45, 45, 226);
  29. }
  30. .model-box {
  31. display: none;
  32. position: absolute;
  33. top: 0;
  34. left: 0;
  35. width: 100%;
  36. height: 100vh;
  37. background-color: rgba(0, 0, 0, 0.45);
  38. }
  39. .content {
  40. display: none;
  41. position: absolute;
  42. top: 100px;
  43. left: calc(50% - 210px);
  44. width: 420px;
  45. height: 350px;
  46. border-radius: 10px;
  47. padding: 0 20px;
  48. box-shadow: 0 2px 12px rgba(116, 65, 65, 0.2);
  49. background-color: rgb(102, 93, 93);
  50. }
  51. .content .title {
  52. display: flex;
  53. justify-content: space-between;
  54. height: 60px;
  55. line-height: 60px;
  56. }
  57. .content .title span {
  58. font-size: 18px;
  59. color: rgb(224, 166, 166);
  60. }
  61. .content .title i {
  62. font-style: normal;
  63. font-size: 24px;
  64. color: rgb(241, 220, 220, 0.322);
  65. cursor: pointer;
  66. }
  67. .content .title i:hover {
  68. color: rgb(37, 37, 206);
  69. }
  70. .content form .form-input {
  71. margin: 22px 0;
  72. }
  73. .content form .form-input label {
  74. font-size: 15px;
  75. color: rgb(236, 241, 236);
  76. cursor: pointer;
  77. }
  78. .content form .form-input input {
  79. outline: 0;
  80. width: 100%;
  81. height: 24px;
  82. padding: 0 15px;
  83. margin-top: 20px;
  84. border: 1px solid rgb(78, 72, 72)
  85. border-radius: 4px;
  86. }
  87. .content form .form-input button {
  88. float: right;
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <button
  94. onclick="document.querySelector('.model-box').style.display='block';document.querySelector('.content').style.display='block'"
  95. >
  96. 登录
  97. </button>
  98. <div
  99. class="model-box"
  100. onclick="document.querySelector('.model-box').style.display='none';document.querySelector('.content').style.display='none'"
  101. ></div>
  102. <div class="content">
  103. <div class="title">
  104. <span>登录窗口</span>
  105. <i
  106. onclick="document.querySelector('.model-box').style.display='none';document.querySelector('.content').style.display='none'"
  107. >x</i
  108. >
  109. </div>
  110. <form action="">
  111. <div class="form-input">
  112. <label for="username">用户名</label>
  113. <input type="text" id="username" />
  114. </div>
  115. <div class="form-input">
  116. <label for="password">密码</label>
  117. <input type="text" id="password" />
  118. </div>
  119. <div class="form-input">
  120. <button>登录</button>
  121. </div>
  122. <div class="form-input">
  123. <button>找回密码</button>
  124. </div>
  125. </form>
  126. </div>
  127. </body>

效果图

flex grid

批改老师:PHPzPHPz

批改状态:合格

老师批语:总结的很好
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学