• 二次元的登录界面


    今天还是继续坚持写博客,然后今天给大家带来比较具有二次元风格的登录界面,也只是用html和css来写的,大家可以来看看!

    个人名片:
     😊作者简介:一名大一在校生,web前端开发专业
     🤡 个人主页:几何小超
     🐼
    座右铭:懒惰受到的惩罚不仅仅是自己的失败,还有别人的成功。
     🎅**学习目标: 坚持每一次的学习打卡,掌握更多知识!虽然都说前端已死,但是就算不靠这个吃饭,学一点东西总比啥也不知道的

    HTML部分

    既然是制作登录界面我们可以使用表单元素,会比盒子更加简单一些,个人相信大家应该可以明白里头的啥意思吧!!!

    这边就介绍一下CSS部分吧

    1. <div class="shell">
    2. <div id="img-box">
    3. <img src="./a34a7810c48ee409750f92812023beb0-1.jpg" alt="">
    4. div>
    5. <form action="" method="post">
    6. <div id="form-body">
    7. <div id="welcome-lines">
    8. <div id="w-line-1">HI,xiaochaodiv>
    9. <div id="w-line-2">Welcome Backdiv>
    10. div>
    11. <div id="input-area">
    12. <div class="f-inp">
    13. <input type="text" placeholder="Email Address">
    14. div>
    15. <div class="f-inp">
    16. <input type="password" placeholder="Password">
    17. div>
    18. div>
    19. <div id="submit-button-cvr">
    20. <button type="submit" id="submit-button">LOGINbutton>
    21. div>
    22. <div id="forgot-pass">
    23. <a href="#">Forgot password?a>
    24. div>
    25. div>
    26. form>
    27. div>

    CSS部分

    还是给我们先清除内外边距

    然后这个ountline:none;的意思是鼠标点击文本框的时候,文本的边框焦点会被去除掉

    还是设置一个背景颜色,这里我们使用的是渐变色:然后在需要让盒子来正中间,需要使用弹性布局

    感觉下面都挺简单的,我就着重讲一下这个伪元素吧placeholder

    placeholder 是HTML5 中新增的一个属性。placeholder可以用来描述输入字段预期值的简短的提示信息。提示信息会在用户输入值之前显示,一旦用户输入信息该提示就会自动消失。比如:我们在登录时需要输入用户名和密码,它会提示你什么地方输入用户名,什么地方输入密码,这个就是使用的placeholder属性。

    1. * {
    2. padding: 0;
    3. margin: 0;
    4. outline: none;
    5. }
    6. body {
    7. background: linear-gradient(45deg, #fbda61, #ff5acd);
    8. display: flex;
    9. justify-content: center;
    10. align-items: center;
    11. height: 100vh;
    12. }
    13. .shell,
    14. form {
    15. position: relative;
    16. }
    17. .shell {
    18. display: flex;
    19. justify-content: center;
    20. }
    21. form {
    22. width: 562px;
    23. height: 520px;
    24. background-color: #fff;
    25. box-shadow: 0px 15px 40px #b6354e;
    26. border-radius: 15px;
    27. display: flex;
    28. justify-content: center;
    29. align-items: center;
    30. }
    31. #img-box {
    32. width: 330px;
    33. height: 520px;
    34. }
    35. #img-box img {
    36. height: 100%;
    37. margin-left: -175px;
    38. border-radius: 20px;
    39. }
    40. #form-body {
    41. width: 320px;
    42. display: flex;
    43. justify-content: center;
    44. align-items: center;
    45. flex-direction: column;
    46. }
    47. #welcome-lines {
    48. width: 100%;
    49. text-align: center;
    50. line-height: 1;
    51. }
    52. #w-line-1 {
    53. color: #7f7f7f;
    54. font-size: 50px;
    55. }
    56. #w-line-2 {
    57. color: #9c9c9c;
    58. font-size: 30px;
    59. margin-top: 17px;
    60. }
    61. #input-area {
    62. width: 100%;
    63. margin-top: 40px;
    64. }
    65. .f-inp {
    66. padding: 13px 25px;
    67. border: 2px solid #6e6d6d;
    68. line-height: 1;
    69. border-radius: 20px;
    70. margin-bottom: 15px;
    71. }
    72. .f-inp input {
    73. width: 100%;
    74. font-size: 14px;
    75. padding: 0;
    76. margin: 0;
    77. border: 0;
    78. }
    79. .f-inp input::placeholder {
    80. color: #b9b9b9;
    81. }
    82. #submit-button-cvr {
    83. margin-top: 20px;
    84. }
    85. #submit-button {
    86. display: block;
    87. width: 100%;
    88. color: #fff;
    89. font-size: 14px;
    90. margin: 0;
    91. padding: 14px 40px;
    92. border: 0;
    93. background-color: #f5506e;
    94. border-radius: 25px;
    95. line-height: 1;
    96. cursor: pointer;
    97. }
    98. #forgot-pass {
    99. text-align: center;
    100. margin-top: 10px;
    101. }
    102. #forgot-pass a {
    103. color: #868686;
    104. font-size: 12px;
    105. text-decoration: none;
    106. }

    接下来展示源码,素材图片就是封面哦

    1. html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
    6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    7. <title>小超&&前端小窝title>
    8. <style>
    9. * {
    10. padding: 0;
    11. margin: 0;
    12. outline: none;
    13. }
    14. body {
    15. background: linear-gradient(45deg, #fbda61, #ff5acd);
    16. display: flex;
    17. justify-content: center;
    18. align-items: center;
    19. height: 100vh;
    20. }
    21. .shell,
    22. form {
    23. position: relative;
    24. }
    25. .shell {
    26. display: flex;
    27. justify-content: center;
    28. }
    29. form {
    30. width: 562px;
    31. height: 520px;
    32. background-color: #fff;
    33. box-shadow: 0px 15px 40px #b6354e;
    34. border-radius: 15px;
    35. display: flex;
    36. justify-content: center;
    37. align-items: center;
    38. }
    39. #img-box {
    40. width: 330px;
    41. height: 520px;
    42. }
    43. #img-box img {
    44. height: 100%;
    45. margin-left: -175px;
    46. border-radius: 20px;
    47. }
    48. #form-body {
    49. width: 320px;
    50. display: flex;
    51. justify-content: center;
    52. align-items: center;
    53. flex-direction: column;
    54. }
    55. #welcome-lines {
    56. width: 100%;
    57. text-align: center;
    58. line-height: 1;
    59. }
    60. #w-line-1 {
    61. color: #7f7f7f;
    62. font-size: 50px;
    63. }
    64. #w-line-2 {
    65. color: #9c9c9c;
    66. font-size: 30px;
    67. margin-top: 17px;
    68. }
    69. #input-area {
    70. width: 100%;
    71. margin-top: 40px;
    72. }
    73. .f-inp {
    74. padding: 13px 25px;
    75. border: 2px solid #6e6d6d;
    76. line-height: 1;
    77. border-radius: 20px;
    78. margin-bottom: 15px;
    79. }
    80. .f-inp input {
    81. width: 100%;
    82. font-size: 14px;
    83. padding: 0;
    84. margin: 0;
    85. border: 0;
    86. }
    87. .f-inp input::placeholder {
    88. color: #b9b9b9;
    89. }
    90. #submit-button-cvr {
    91. margin-top: 20px;
    92. }
    93. #submit-button {
    94. display: block;
    95. width: 100%;
    96. color: #fff;
    97. font-size: 14px;
    98. margin: 0;
    99. padding: 14px 40px;
    100. border: 0;
    101. background-color: #f5506e;
    102. border-radius: 25px;
    103. line-height: 1;
    104. cursor: pointer;
    105. }
    106. #forgot-pass {
    107. text-align: center;
    108. margin-top: 10px;
    109. }
    110. #forgot-pass a {
    111. color: #868686;
    112. font-size: 12px;
    113. text-decoration: none;
    114. }
    115. style>
    116. head>
    117. <body>
    118. <div class="shell">
    119. <div id="img-box">
    120. <img src="./a34a7810c48ee409750f92812023beb0-1.jpg" alt="">
    121. div>
    122. <form action="" method="post">
    123. <div id="form-body">
    124. <div id="welcome-lines">
    125. <div id="w-line-1">HI,xiaochaodiv>
    126. <div id="w-line-2">Welcome Backdiv>
    127. div>
    128. <div id="input-area">
    129. <div class="f-inp">
    130. <input type="text" placeholder="Email Address">
    131. div>
    132. <div class="f-inp">
    133. <input type="password" placeholder="Password">
    134. div>
    135. div>
    136. <div id="submit-button-cvr">
    137. <button type="submit" id="submit-button">LOGINbutton>
    138. div>
    139. <div id="forgot-pass">
    140. <a href="#">Forgot password?a>
    141. div>
    142. div>
    143. form>
    144. div>
    145. body>
    146. html>

    最后的效果是这样子的:

    大家可以尝试敲一敲,这样一步步就会了解到这种类型的布局,然后自己在尝试几次就可以自己来写自己的专属登录界面然后后期通过js完善一下会更加完美哦!!

    看到这别忘三连加关注,爱你们!!!!

  • 相关阅读:
    计算机毕业设计Java冠军体育用品购物网站(源码+系统+mysql数据库+Lw文档)
    【HDFS】ResponseProcessor线程详解以及客户端backoff反压
    wpf 异步等待框
    【云原生之Docker实战】使用Docker部署Trilium个人笔记工具
    vscode远程登录ubuntu linux报错,一直输入密码问题
    FreeRTOS之信号量
    Hooks与事件绑定
    【达摩院OpenVI】开源体验AI云台,去视频抖动
    VMware和Debian下载
    shopify独立站的运营
  • 原文地址:https://blog.csdn.net/weixin_64965154/article/details/130907893