登录界面01
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | <! DOCTYPE html> < html lang="zh-CN"> < head > < meta charset="utf-8" /> < meta name="viewport" content="width=device-width,initial-scale=1.0" /> < title >用户登录</ title > < style type="text/css"> *{ /*初始化 清除页面元素的内外边距*/ padding: 0; margin: 0; /*盒子模型*/ box-sizing: border-box; } body { /*弹性布局 让页面元素垂直+水平居中*/ display: flex; justify-content: center; align-items: center; /*让页面始终占浏览器可视区域总高度*/ height: 100vh; /*背景渐变色*/ background: linear-gradient(#141e30,#243b55); } .login{ /*弹性布局 让子元素称为弹性项目*/ display: flex; /*让弹性项目垂直排列 原理是改变弹性盒子的主轴方向 父元素就是弹性盒子 现在改变后的主轴方向是向下了*/ flex-direction: column; /*让弹性项目在交叉轴方向水平居中 现在主轴的方向是向下 交叉轴的方向是与主轴垂直 交叉轴的方向是向右*/ align-items: center; width: 400px; padding: 40px; background-color: rgba(0, 0, 0, 0.2); box-shadow: 0 15px 25px rgba(0, 0, 0, 0.4); } .login h2{ color: #fff; margin-bottom: 30px; } .login .login_box { /*相对定位*/ position: relative; width: 100%; } .login .login_box input{ /*清除input框自带的边框和轮廓*/ outline: none; border: none; width: 100%; padding: 10px 0; margin-bottom: 30px; color: #fff; font-size: 16px; border-bottom: 1px solid #fff; /*背景颜色为透明色*/ background-color: transparent; } .login .login_box label{ position:absolute; top: 0 ; left: 0; padding: 10px 0; color: #fff; /*这个属性的默认值是auto 默认是这个元素可以被点击 但是如果我们写了none 就是这个元素不能被点击,就好像它可见但是不能用 可望而不可及*/ /*这个就是两者的区别*/ pointer-events: none; /*加个过度*/ transition: all 0.5s; } /*: focus 选择器是当input获得焦点是触发的样式 + 是相邻兄弟选择器 去找与input相邻的兄弟label*/ /*:valid 选择器是判断input 框的内容是否合法,如果合法会执行下面的属性代码, 不合法就不会执行,我们刚开始写布局的时候给input框写了required 我们删掉看对比 当没有required的话 input框的值就会被认为一直合法,所以一直都是下方的样式, 但是密码不会,密码框的值为空,那么这句话就不合法,required不能为空 当我们给密码框写点东西的时候才会执行以下代码 */ .login .login_box input:focus + label, .login .login_box input:valid + label{ top: -20px; color: #03e9f4; font-size: 12px; } .login a{ /*overflow: hidden;*/ position: relative; padding: 10px 20px; color: #03e9f4; /*取消a表现原有的下划线*/ text-decoration: none; /*同样加个过渡*/ transition: all 0.5s; } .login a:hover { color: #fff; border-radius: 5px; background-color: #03e9f4; box-shadow: 0 0 5px #03e9f4,0 0 25px #03e9f4,0 0 50px #03e9f4,0 0 100px #03e9f4; } .login a span{ position: absolute; } .login a span:first-child { top: 0; left: -100%; width: 100%; height: 2px; /*to right 就是往右边 下面的同理*/ background: linear-gradient(to right,transparent,#03e9f4); /*动画 名称 时长 linear是匀速运动 infinite是无限次运动*/ animation: move1 1s linear infinite; } .login a span:nth-child(2){ right: 0; top: -100%; width: 2px; height: 100%; background: linear-gradient(transparent,#03e6f4); /*这里多了个0.25s其实是延迟时间*/ animation: move2 1s linear 0.25s infinite; } .login a span:nth-child(3){ right: -100%; bottom: 0; width: 100%; height: 2px; background: linear-gradient(to left,transparent,#03e9f4); animation: move3 1s linear 0.5s infinite; } .login a span:last-child{ left: 0; bottom: -100%; width: 2px; height: 100%; background: linear-gradient(#03e9f4,transparent); animation: move4 1s linear 0.75s infinite; } /*写一下动画 */ @keyframes move1{ 0%{ left: -100%; } 50%, 100%{ left: 100%; } } @keyframes move2{ 0%{ top: -100%; } 50%, 100%{ top: 100%; } } @keyframes move3{ 0%{ right: -100%; } 50%, 100%{ right: 100%; } } @keyframes move4{ 0%{ bottom: -100%; } 50%, 100%{ bottom: 100%; } } </ style > </ head > < body > < div class="login"> < h2 >用户登录</ h2 > < div class="login_box"> <!-- required就是不能为空 必须在css效果中有很大的作用 --> < input type="text" name='name' id='name' required /> < label for="name" >用户名</ label > </ div > < div class="login_box"> < input type="password" name='pwd' id='pwd' required="required"> < label for="pwd">密码</ label > </ div > < a href="javascript:void(0)"> 登录 < span ></ span > < span ></ span > < span ></ span > < span ></ span > </ a > </ div > </ body > </ html > |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现