css+html做一个简单的页面
这几天复习了一下html和css知识
为了巩固一下
所以写了个简单地页面
话不多说直接上代码
html代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>老闫真牛逼之-个人主页</title> <link rel="stylesheet" type="text/css" href="../assets/test_css.css"> </head> <body> <div id="div1"> <div id="div1_div1"><p>老闫真牛批之-老闫个人主页</p></div> <div><a href="" id = div1_a3>About</a></div> <div><a href="">Work</a></div> <div><a href="" >Contact</a></div> </div> <div id="div2"> <div id="div2_1"> <div id="div2_1_1"><label>嗨!我是老闫~</label></div> <div id="div2_1_2"><label>A niubi tester</label></div> </div> </div> <div id="div3"> <div id="div3_1"> <label>These are some of my article</label> </div> <div id="div3_2"> <div id="div3_2_1"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/tribute.jpg"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章1</a> </div> <div id="div3_2_2"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/random-quote-machine.png"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章2</a> </div> <div id="div3_2_3"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/calc.png"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章3</a> </div> </div> <div id="div3_3"> <div id="div3_3_1"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/map.jpg"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章4</a> </div> <div id="div3_3_2"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/wiki.png"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章5</a> </div> <div id="div3_3_3"> <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/tic-tac-toe.png"> <a href="https://www.cnblogs.com/laoyan666/p/15603521.html">文章6</a> </div> </div> <div id="div3_4"> <a href="https://www.cnblogs.com/laoyan666/">HOME》</a> </div> </div> <div id="div4"> <div id="div4_1"> <div id="div4_1_1"><label>Let's work together...</label></div> <div id="div4_1_2"><label>How do you take your coffee?</label></div> </div> <div id="div4_2"> <div id="div4_2_1"><a>Facebook</a></div> <div id="div4_2_2"><a>GitHub</a></div> <div id="div4_2_3"><a>Twitter</a></div> <div id="div4_2_4"><a>Send a mail</a></div> <div id="div4_2_5"><a>Call me</a></div> <!-- <ul>--> <!-- <li>Facebook</li>--> <!-- <li>GitHub</li>--> <!-- <li>Twitter</li>--> <!-- <li>Send a mail</li>--> <!-- <li>Call me</li>--> <!-- </ul>--> </div> </div> </body> </html>
css代码
body{ margin: 0; padding: 0; width: 100%; } #div1{ height: 100px; width: 100%; background-color: #be3144; position: fixed; z-index: 100; top: 0; border-bottom: black solid; } #div1_div1{ color: aliceblue; font-family: 'Poppins', sans-serif; width: 400px; font-size: 40px; /*background-color: green;*/ position: absolute; top: -25px; left: 20px; height: 100px; } /*#div1_div1>p{*/ /* background-color: red;*/ /* line-height: 100px;*/ /* position: relative;*/ /* top: -10;*/ /*}*/ #div1>div{ /*background-color: green;*/ font-size: 25px; /*margin-left: 30px ;*/ float: right; line-height: 100px; } #div1>div>a{ text-align: center; display:block; width: 120px; color: aliceblue; font-family: 'Poppins', sans-serif; text-decoration:none; height: 100px; } #div1_a3{ margin-right: 40px; } #div1>div>a:hover{ background-color: #303841; color: aliceblue; } /*页面上层布局-1*/ #div2{ background-color: #303841; /*background-color: yellow;*/ height: 950px; width: 100%; position: relative; top: 100px; text-align: center; } #div2_1_1{ font-size: 100px; color: aliceblue; font-family: 华文行楷; position: absolute; left: 30%; top: 30%; } #div2_1_2{ font-size: 40px; color: #be3144; font-family: 隶书; font-style:oblique; position: absolute; left: 40%; top: 42%; } /*页面上层布局-2*/ #div3{ background-color: #45567d; /*background-color: blueviolet;*/ height: 1300px; width: 100%; position: relative; text-align: center; } img{ width: 370px; height: 340px; } a{ display: block; text-decoration:none; } #div3_1{ font-size: 50px; text-decoration: underline; font-family: 楷体; color: aliceblue; position: relative; top: 100px; } #div3_2{ text-align: center; position: relative; top: 150px; margin-left:auto;margin-right:auto; } #div3_2_1>a{ color: aliceblue; } #div3_2_2>a{ color: aliceblue; } #div3_2_3>a{ color: aliceblue; } a:hover{ background-color: darkslateblue; } #div3_2_1{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 16%; } #div3_2_2{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 39%; } #div3_2_3{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 62%; } #div3_3{ text-align: center; position: relative; top: 600px; /*left: 17%;*/ } #div3_3_1>a{ color: aliceblue; } #div3_3_2>a{ color: aliceblue; } #div3_3_3>a{ color: aliceblue; } a:hover{ background-color: darkslateblue; } #div3_3_1{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 16%; } #div3_3_2{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 39%; } #div3_3_3{ font-family: 楷体; font-size: 30px; background-color: #303841; position: absolute; left: 62%; } #div3_4{ background-color: black; position: relative; left: 45%; top: 1080px; font-size: 20px; width: 150px; height: 50px; line-height: 50px; text-align: center; } #div3_4>a{ color: white; } #div4{ background-color: #303841; /*background-color: green;*/ height: 1000px; width: 100%; position: relative; text-align: center; /*top: 100px;*/ } #div4_1{ position: relative; top: 20%; } #div4_1_1{ color: aliceblue; font-size: 70px; } #div4_1_2{ color: aliceblue; font-size: 20px; } #div4_2{ font-size: 30px; color: aliceblue; position: relative; top: 25%; } #div4_2_1{ position: absolute; top: 0; left: 30%; } #div4_2_3{ position: absolute; top: 0; left: 30%; } #div4_2_3{ position: absolute; top: 0; left: 40%; } #div4_2_4{ position: absolute; top: 0; left: 55%; } #div4_2_5{ position: absolute; top: 0; left: 66%; } #div4_2>div>a:hover{ background-color: darkslateblue; margin-top: 10px; }
效果截图
前端大佬请忽视
小白写着玩
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?