博客列表 >1030 改写模态框案例

1030 改写模态框案例

Yuming
Yuming原创
2020年11月02日 02:14:58542浏览

改写模态框案例

模态框使用的的是定位技术和网格布局,这边登录注册仿写,效果如下

  1. <div class="container">
  2. <header>YouKu登录</header>
  3. <div class="model-login">
  4. <div class="model-bg"></div>
  5. <div class="model-body">
  6. <div class="close">
  7. <i class="fa fa-times" aria-hidden="true"></i>
  8. </div>
  9. <h2 class="title">账号登录/注册</h2>
  10. <form action="">
  11. <label for="账号">账号</label>
  12. <input type="text" placeholder="手机/邮箱/优酷土豆账号" />
  13. <label for="密码">密码</label>
  14. <input type="text" placeholder="注册/登录密码" />
  15. <div class="forget-pwd">忘记密码</div>
  16. <button>登录</button>
  17. </form>
  18. <div class="user-policy">
  19. 点击登录或完成账号注册表示您已阅读并同意优酷
  20. <em>《用户协议》</em><em>《隐私政策》</em>
  21. </div>
  22. <div class="annother-login">
  23. <div class="title">其他登录方式</div>
  24. <div class="annother-icon">
  25. <div class="row">
  26. <span
  27. ><img
  28. src="https://gw.alicdn.com/tfs/TB1A8GcBAP2gK0jSZPxXXacQpXa-72-72.png"
  29. alt=""
  30. /></span>
  31. <span
  32. ><img
  33. src="https://gw.alicdn.com/tfs/TB1A8GcBAP2gK0jSZPxXXacQpXa-72-72.png"
  34. alt="" /></span
  35. ><span
  36. ><img
  37. src="https://gw.alicdn.com/tfs/TB1A8GcBAP2gK0jSZPxXXacQpXa-72-72.png"
  38. alt="" /></span
  39. ><span
  40. ><img
  41. src="https://gw.alicdn.com/tfs/TB1A8GcBAP2gK0jSZPxXXacQpXa-72-72.png"
  42. alt="" /></span
  43. ><span
  44. ><img
  45. src="https://gw.alicdn.com/tfs/TB1A8GcBAP2gK0jSZPxXXacQpXa-72-72.png"
  46. alt=""
  47. /></span>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="other">
  52. <span>注册</span><span>登录/注册遇到问题?</span>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  1. * {
  2. padding: 0;
  3. margin: 0;
  4. box-sizing: border-box;
  5. }
  6. .container {
  7. .model-login {
  8. // 登录注册蒙版层
  9. .model-bg {
  10. background-color: rgba(0, 0, 0, 0.5);
  11. position: absolute;
  12. top: 0;
  13. left: 0;
  14. right: 0;
  15. bottom: 0;
  16. z-index: -1;
  17. }
  18. // 注册/登录模态对话框
  19. .model-body {
  20. position: relative;
  21. z-index: 999;
  22. width: 30em;
  23. height: max-content;
  24. padding: 2em;
  25. margin: 20em auto;
  26. background-color: #fff;
  27. border-radius: 0.5em;
  28. .close {
  29. position: absolute;
  30. top: 1rem;
  31. left: 1em;
  32. font-size: 1.5em;
  33. }
  34. .title {
  35. text-align: right;
  36. }
  37. form {
  38. display: grid;
  39. grid-template-columns: 4em 22em;
  40. row-gap: 2em;
  41. margin-top: 2em;
  42. input {
  43. border: none;
  44. }
  45. .forget-pwd {
  46. grid-area: span 1 / span 2;
  47. text-align: right;
  48. }
  49. button {
  50. grid-area: span 1 / span 2;
  51. line-height: 2em;
  52. background-color: #00d3ff;
  53. font-size: 1.3em;
  54. color: white;
  55. border-radius: 2em;
  56. }
  57. }
  58. .user-policy {
  59. padding: 0 2em;
  60. text-align: center;
  61. margin-top: 0.5em;
  62. color: #ccc;
  63. em {
  64. color: blue;
  65. }
  66. }
  67. .annother-login {
  68. .title {
  69. display: flex;
  70. align-items: center;
  71. justify-content: center;
  72. color: #ccc;
  73. margin-top: 1em;
  74. &::before {
  75. content: " ";
  76. display: inline-block;
  77. background-color: #ccc;
  78. width: 3em;
  79. height: 1px;
  80. }
  81. &::after {
  82. content: " ";
  83. display: inline-block;
  84. background-color: #ccc;
  85. width: 3em;
  86. height: 1px;
  87. }
  88. }
  89. .annother-icon {
  90. margin-top: 1em;
  91. .row {
  92. display: grid;
  93. grid-template-columns: repeat(5, 1fr);
  94. text-align: center;
  95. span {
  96. grid-area: span 1 / span 1;
  97. img {
  98. max-width: 3em;
  99. }
  100. }
  101. }
  102. }
  103. }
  104. .other {
  105. display: flex;
  106. justify-content: space-between;
  107. margin-top: 2em;
  108. }
  109. }
  110. }
  111. }

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议