博主信息
博文 22
粉丝 0
评论 0
访问量 15821
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
模态框练习
没耐心的渔翁
原创
757人浏览过

模态框练习

代码:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>弹窗</title>
  7. </head>
  8. <style>
  9. * {
  10. margin: 0px;
  11. padding: 0px;
  12. }
  13. .div1 {
  14. width: 100%;
  15. height: 50px;
  16. background: blue;
  17. color: white;
  18. padding: 8px 16px;
  19. }
  20. .div1 h1 {
  21. padding-top: 15px;
  22. font-size: 16px;
  23. ;
  24. }
  25. .div1 button {
  26. position: fixed;
  27. right: 0;
  28. }
  29. /* .div2{
  30. display: none;
  31. } */
  32. .div2 input {
  33. width: 220px;
  34. height: 27px;
  35. border: 1px solid blue;
  36. border-radius: 5px;
  37. margin-left: 45px;
  38. }
  39. .btu {
  40. width: 220px;
  41. height: 26px;
  42. /* 去掉边框 */
  43. border: none;
  44. /* 设置圆角 */
  45. border-radius: 5px;
  46. background: seagreen;
  47. color: white;
  48. /* 外边距向左侧移动 */
  49. margin-left: 45px;
  50. }
  51. /* 模态框 */
  52. .div2 fieldset {
  53. border-radius: 5px;
  54. border: none;
  55. width: 300px;
  56. height: 250px;
  57. background: rgb(255, 255, 255);
  58. /* 固定定位 */
  59. position: fixed;
  60. top: 200px;
  61. left: 600px;
  62. }
  63. /* <!-- 半透明框 --> */
  64. .div3 {
  65. /* 固定定位 */
  66. position: fixed;
  67. /* 定位四个角 全部清零 */
  68. top: 0;
  69. left: 0;
  70. right: 0;
  71. bottom: 0;
  72. background-color: rgb(0, 0, 0, 0.5);
  73. }
  74. .div2 p {
  75. font-weight: 700px;
  76. color: #1c2438;
  77. text-align: center;
  78. }
  79. </style>
  80. <!-- 去掉滚动条 -->
  81. <body style="overflow:-Scroll;overflow-x:hidden">
  82. <div class="div1">
  83. <h1>学生管理系统</h1>
  84. <button >登录</button>
  85. </div>
  86. <!-- 模态框 -->
  87. <div class="div2">
  88. <!-- 半透明框 -->
  89. <div class="div3"></div>
  90. <form ction="">
  91. <fieldset>
  92. <div style="line-height: 65px;">
  93. <p>欢迎登录学生管理系统</p>
  94. <hr />
  95. <input type="tetx" name="username" placeholder="用户名" />
  96. </div>
  97. <div>
  98. <input type="password" name="password" placeholder="密码">
  99. </div>
  100. <div style="line-height:65px;">
  101. <button class="btu">登录</button>
  102. </div>
  103. </fieldset>
  104. </form>
  105. </div>
  106. </body>
  107. </html>

模态框

批改老师:PHPzPHPz

批改状态:合格

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

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

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