首先是用html 语言来搭建框架
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <title>Bymax</title> |
| <link rel="stylesheet" href="dabai.css"> |
| </head> |
| <body> |
| <div class="baymax"> |
| |
| <div class="head"> |
| <div class="eye"></div> |
| <div class="eye2"></div> |
| <div class="mouth"></div> |
| </div> |
| |
| <div class="torso"> |
| <div class="heart"> </div> |
| </div> |
| |
| <div class="belly"> |
| <div class="cover" =""></div> |
| </div> |
| |
| <div class="left-arm"> |
| <div class="l-bigfinger"></div> |
| <div class="l-smallfinger"></div> |
| </div> |
| |
| <div class="right-arm"> |
| <div class="r-bigfinger" ></div> |
| <div class="r-smallfinger"></div> |
| </div> |
| |
| <div class="left-leg"></div> |
| <div class="right-leg"></div> |
| |
| </div> |
| </body> |
| </html> |
如果你要构建一个页面,你首先要想好页面里面的内容有什么,它的组成,像画画一样一个一个去画
然后才是用css,排版出来,每一个css里面一般都是位置,大小,边框,效果,颜色。
如果你构建的是网站html 里面的html 标签就多,相对应的css ,就要考虑选择器,使用定义整体,再定义局部,我觉得对于一个网页来说,最重要的是在编码前对于页面整体的把握,之后去考虑细节的实现。如果以后我发现这一点不对,或者要补充,我会回来修改这篇博客。
css 来描绘图片样式:
| body{ |
| background: red; |
| } |
| .baymax{ |
| margin: 200px auto 0px ; |
| height: 500px; |
| |
| overflow: hidden; |
| |
| } |
| .head{ |
| height: 64px; |
| width: 100px; |
| border-radius: 50%; |
| background: #fff; |
| margin: 0 auto; |
| margin-bottom: -20px; |
| border-bottom: 5px solid #e0e0e0; |
| z-index: 100; |
| position: relative; |
| } |
| .eye, |
| .eye2{ |
| width: 11px; |
| height: 13px; |
| background: #282828; |
| border-radius: 50px; |
| position: relative; |
| top: 30px; |
| left: 27px; |
| transform: rotate(8deg); |
| } |
| |
| |
| .eye2{ |
| transform: rotate(-8deg); |
| left: 69px; |
| top: 17px; |
| } |
| .mouth{ |
| width: 38px; |
| height: 1.5px; |
| background: #282828; |
| position: relative; |
| left: 34px; |
| top: 10px; |
| } |
| .torso,.belly{ |
| margin: 0 auto; |
| height: 200px; |
| width: 180px; |
| background: #fff; |
| border-radius: 47%; |
| border-bottom: 5px solid #e0e0e0; |
| border-top: none; |
| z-index: 1; |
| } |
| .belly{ |
| height: 300px; |
| width: 245px; |
| margin-top:-140px; |
| z-index: 1; |
| } |
| .cover{ |
| width: 190px; |
| background: #fff; |
| height: 150px; |
| margin: 0 auto; |
| position: relative; |
| top: -20px; |
| border-radius: 50%; |
| } |
| .heart{ |
| width: 25px; |
| height: 25px; |
| border-radius: 50px ; |
| position: relative; |
| box-shadow: 2px 5px #ccc inset; |
| right: -115px; |
| top:40px; |
| z-index: 111; |
| border: 1px solid #ccc; |
| |
| } |
| .left-arm, |
| .right-arm{ |
| height: 270px; |
| width: 120px; |
| border-radius: 50%; |
| background: #fff; |
| margin: 0 auto; |
| position: relative; |
| top: -350px; |
| left: -100px; |
| transform: rotate(20deg); |
| z-index:-1; |
| } |
| .right-arm{ |
| transform: rotate(-20deg); |
| left: 100px; |
| top: -620px; |
| } |
| |
| .l-bigfinger, |
| .r-bigfinger{ |
| height: 50px; |
| width: 20px; |
| border-radius: 50%; |
| background: #fff; |
| position: relative; |
| top: 250px; |
| left: 60px; |
| transform:rotate(-50deg); |
| } |
| .r-bigfinger{ |
| background:#fff; |
| transform:rotate(50deg); |
| top: 248px; |
| left: 40px; |
| } |
| .l-smallfinger, |
| .r-smallfinger{ |
| height: 35px; |
| width: 15px; |
| border-radius: 50%; |
| background: #fff; |
| position: relative; |
| top: 195px; |
| left: 76px; |
| transform: rotate(-40deg); |
| } |
| .r-smallfinger{ |
| background: #fff; |
| transform: rotate(40deg); |
| top: 195px; |
| left: 27px; |
| } |
| .left-leg, |
| .right-leg{ |
| height: 170px; |
| width: 80px; |
| border-radius: 30% 70%; |
| background: #fff; |
| position: relative; |
| top: -640px; |
| left:-50px; |
| transform: rotate(-1deg); |
| z-index: -2; |
| margin: 0 auto; |
| } |
| .right-leg{ |
| border-radius: 70% 30%; |
| margin: 0 auto; |
| top: -810px; |
| left: 45px ; |
| transform: rotate(1deg); |
| } |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具