使用HTML+CSS制作一个简单的网页

article/2025/10/9 8:29:56

简单学习了一下HTML和CSS,制作了下面这个网页(第一次做还在学习中),里面包含一些基础的布局包括导航条、分页栏、悬浮列表等内容。

网页预览(网页中的图片与图标均来自阿里巴巴矢量图标库)
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


CSS代码
里面包含悬浮、画面自适应等效果

* {box-sizing: border-box;
}
body {padding: 5px;background: #4682B4; 
}
.header {padding: 10px;background: #87CEEB;overflow: auto; 
}
.header a {text-decoration: none; 
}
.biaoti1 {display: inline-block;    
}
.relation {display: inline-block;float: right;margin: 18px 200px 0 0;
}
.relation a{text-decoration: none;color: #FFFACD;
}
.relation a:hover {color: blue;
}
.biaoti1 h1 {padding: 0 20px 0 20px;margin: 8px 8px 0 30px;font-family: Serif;font-size: 5vw;color: #FFFACD;text-shadow: 4px 4px 8px #8B4513;
}
.biaoti1 p {padding: 0 20px 0 20px;margin: 8px 8px 0 50px;font-family: Arial;font-size: 2vw;color: #FFFACD;text-shadow: 4px 4px 8px #8B4513;    
}
.logo {display: inline-block;margin: 8px 0 0 100px;max-width: 11%;height: auto;border-radius: 25px;	
}
.topnav {text-align:center; overflow: hidden;background-color: #AFEEEE;
}
.topnav li {display: inline;
}
.topnav a {display: inline;color: #F8F8FF;text-align: center;padding:16px;font-family: Arial;text-decoration: none;
}
.topnav a:hover {background-color: #FFFACD;color: black;
}
.active {background-color: #4CAF50;
}
.row:after {content: "";display: table;clear: both;
}
.menubtn {background-color: #00BFFF;color: white;padding: 16px;font-size: 16px;border: none;cursor: pointer;
}
.menu {overflow: visibleposition: relative;display: inline-block;
}
.menu-content {display: none;position: absolute;background-color: #FFFAF0;box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);z-index: 1;padding: 0;margin: 12px 0 0 0;min-width: 140px;
}
.menu-content li {display: block;}
.menu-content a {color: black;text-align:left;padding: 12px 16px;text-decoration: none;display: block;
}
.menu-content a:hover {background-color: #f1f1f1}
.menu:hover .menu-content {display: block;background-color: white;
}
.menu:hover .menubtn {background-color: #FFFACD;color: black;
}
.content {float: left;width: 20%;padding: 10px;height: 500px;font-size: 17px;letter-spacing: 2px;text-indent: 30px;line-height: 1.5;                                      border-radius: 9px;overflow: auto;background-color: #ADD8E6;
}
.content-main {float: left;width: 60%;padding: 10px;height: 500px;font-size: 17px;letter-spacing: 2px;text-indent: 30px;line-height: 1.5;border-radius: 9px;overflow: auto;background-color: #D4F2E7;
}
.content:hover {background-color: #FFFACD;box-shadow: 0 4px 8px 4px rgba(0, 0, 0, 0.3), 0 6px 20px 6px rgba(0, 0, 0, 0.19);
}
.content-main:hover {background-color: #FFFACD;box-shadow: 0 4px 8px 4px rgba(0, 0, 0, 0.3), 0 6px 20px 6px rgba(0, 0, 0, 0.19);
}
@media screen and (max-width:1000px) {//画面自适应.row ,.leftcolumn ,.rightcolumn ,.row2 {width: 100%;  }
}
@media screen and (max-width:900px) {.topnav ,.menu ,.relation a ,.slidenav {display:none;}.logo {margin:0;padding:0;}.biaoti1 h1 ,.biaoti1 p{     width: 30%;  height: 30%;margin:0;padding: 0;}
}
.biaoti2 {text-align: center;font-family: Arial;font-size: 40px;color: #FFFACD;
}
.leftcolumn {   float: left;width: 75%;
}
.card-hp {display: inline-block;	
}
.card-img {display: inline-block;float: right;
}
.rightcolumn {float: left;width: 25%;padding-left: 15px;
}
.card-img-right {text-align: center;
}
.card {background-color: white;padding: 20px;margin-top: 20px;overflow: auto;border-radius: 5px;
}
.card:hover {background-color: rgba(173,216,230, 0.5);box-shadow: 0 4px 8px 4px rgba(0, 0, 0, 0.3), 0 6px 20px 6px rgba(0, 0, 0, 0.19);
}
.row2 {background-color: #D4F2E7;
}
.row2:after {content: "";display: table;clear: both;
}
.chuanglian {margin: 5px;border: 1px solid #ccc;float: left;width: 200px;border-radius: 0 0 15px 15px;
}
.chuanglian img {width: 100%;height: auto;
}
.chuanglian:hover {box-shadow: 0 4px 8px 4px rgba(0, 0, 0, 0.3), 0 6px 20px 6px rgba(0, 0, 0, 0.19);
}
.text{padding: 10px;text-align: center;border-radius: 0 0 15px 15px;background-color: rgba(173,216,230, 0.5);
}
.text:hover {color: green;
}
.center {text-align: center;background-color: rgba(173,216,230, 0.5);
}
.pagination {display: inline-block;padding: 5px 0 0 0;
}
.pagination a {color: black;float: left;padding: 8px 16px;text-decoration: none;transition: background-color .3s;
}
.pagination a.active {background-color: #4CAF50;color: white;
}
.pagination a:hover:not(.active) {background-color: #ddd;}
.footer {padding: 20px;text-align: left;background: #F0FFFF;margin-top: 20px;border-radius: 9px;font-size: 28px;color: 	#008080;
}
.f1 :hover {top:10px;
}
.banquan {padding: 7px;text-align: center;background: rgba(173,216,230, 0.5);margin-top: 20px;font-size: 15px;
}
.banquan a {text-decoration: none;color: 	#008080;
}
.tool {float: right;position: relative;display: inline-block;border-bottom: 1px dotted black;font-size: 20px;
}
.tool .tooltext {visibility: hidden;width: 120px;background-color: #F5F5DC;color: black;text-align: center;padding: 5px 0;border-radius: 25px;font-size: 10px;/* 定位工具提示 */position: absolute;z-index: 1;top: 5px;right: 105%;
}
.tool:hover .tooltext {visibility: visible;
}
.slidenav {position: fixed;top: 200px;right: 0;width: 90px;height:300px;text-align:center;border-radius: 25px 0 0 25px;background-color: rgba(255,255,255, 0.3);
}
.slidenav a{text-decoration: none;
}
.slidenav a:hover {color: blue;
}

HTML代码

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--头部-->
<div class="header"><a href="#"><img class="logo" src="D:\image\logo.png" alt="LOGO"></a><div class="biaoti1"><h1>Fabrics</h1><br /><p>Home Textile</p></div><div class="relation"><a href="#"><img src="D:\image\login.png" width="50" height="50"><div>log in</div></a><a href="#"><img src="D:\image\signin.png" width="50" height="50"><div>sign in</div></a></div>
</div>
<!--导航栏-->
<div class="topnav"><ul><li><a href="#">Home</a></li><li><a href="#">Work</a></li><li><a href="#">News</a></li><li><a href="#">Link</a></li><li><a href="#">Link</a></li><div class="menu"><li><a class="menubtn" href="#">Menu</a></li><ul class="menu-content"><li><a href="#">1111</a></li><li><a href="#">2222</a></li><li><a href="#">3333</a></li></ul></div></ul>
</div>
<!--主内容1-->
<div class="row"><div class="content"><h2>Product</h2><p>Some text..</p></div><div class="content-main"><h2>New Product</h2><p>Some text..</p></div><div class="content"><h2>Product</h2><p>Some text..</p></div>
</div>
<!--主内容2-->
<div class="biaoti2"><h2>Category</h2> 
</div>
<div class="row2"><!--左框--><div class="leftcolumn"><div class="card"><div class="card-hp"><h2>high accuracy</h2><h4>door curtain made of cloth</h4><h4>sheer curtain</h4>		<p>Some introduction...</p><p>Some introduction...</p></div><div class="card-img"><img src="D:\image\1.png" alt="1" width="300" height="300"></div></div><div class="card"><div class="card-hp"><h2>pashm</h2><h4>door curtain made of cloth</h4><h4>sheer curtain</h4><p>Some introduction...</p><p>Some introduction...</p></div><div class="card-img"><img src="D:\image\2.png" alt="2" width="300" height="300"></div></div></div><!--右框--><div class="rightcolumn"><div class="card"><h2>123</h2><p>Some text..</p></div><div class="card"><h2>123</h2><div class="card-img-right"><img src="D:\image\3.png" alt="3" width="300" height="300"></div></div><div class="card"><h2>123</h2><p>Some text..</p></div></div>
</div>
<!--主内容3-->
<div class="biaoti2"><h2>Picture</h2>
</div>
<div class="row2">
<div class="chuanglian"><img src="D:\image\1.png" alt="1" ><div class="text">1号</div>	
</div>
<div class="chuanglian"><img src="D:\image\2.png" alt="2" ><div class="text">2号</div>	
</div>
<div class="chuanglian"><img src="D:\image\3.png" alt="3" ><div class="text">3号</div>	
</div>
</div>
<!--分页-->
<div class="center"><div class="pagination"><a href="#">«</a><a href="#" class="active">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">»</a></div>
</div>
<!--底部-->
<div class="footer"><div><h2>Footer</h2></div><div class="row"><div class="tool">联系方式<span class="tooltext">Tooltext</span></div></div>
</div>
<!--悬浮列表-->
<div class="slidenav"><div class="slidecontact"><a href="#"><img src="D:\image\top.png" width="70" height="70"><div>top</div></a></div><div class="slidecontact"><a href="#"><img src="D:\image\shopping.png"width="70" height="70"><div>shopping</div></a></div><div class="slidecontact"><a href="#"><img src="D:\image\relation.png"width="70" height="70"><div>relation</div></a></div>
</div>
<!--版权-->
<div class="banquan"><a href="#">banquan</a>
</div>
</body>
</html>

http://chatgpt.dhexx.cn/article/13AdFvy7.shtml

相关文章

简单HTML网页制作 实例

HTML网页制作 1.新建文本文档&#xff0c;以“html”结尾。 2.用html网页逻辑器打开&#xff0c;这里我们用Sublime Text打开。 Tips&#xff1a;使用 &#xff01;Tab 按键 那么就可以自动生成HTML文档模板 推荐大家使用的前端工具有 Vscode hbuilder sublime_text 等等 …

简单网页的制作

传送门链接&#xff1a; 聊聊制作网站那些事 开头先开个小灶&#xff1a;响应式网站 响应式网站就是让网页自适应手机端和PC端&#xff0c;是一种网络页面设计布局&#xff0c;其理念是:集中创建页面的图片排版大小&#xff0c;可以智能地根据用户行为以及使用的设备环境进行…

用html制作简易网页

一.案例展示 案例图展与项目位置如下&#xff1a; 二、使用步骤 1.HTML代码&#xff1a; 代码如下&#xff1a; 圣诞节案例&#xff1a;<!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <meta http-equiv&…

html简单的网页制作

1.用html做一个简单的网页&#xff0c;需要注意布局&#xff0c;布局就需要好好运用css 下面是我做的一个页面效果图&#xff1a; 还有一些不够完善的地方&#xff0c;需要继续摸索努力。下面上代码: <html> <head><meta charset"utf-8"><ti…

一个简单完整的网页

获得源码链接&#xff0c;点击这里https://github.com/suviwang312/SimpleFullPage 网页头部banner和信息部分新闻部分底部 一 头部 效果&#xff1a; 先对css进行初始化 分析&#xff1a;头部有一张图片和一个input输入框还有一个按钮下面的通栏 因为用到左浮&#xff0c…

【手把手】制作一个简单的HTML网页

前些天发现了一个巨牛的人工智能学习博客&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转 新建一个html文件&#xff1a; 我要给body添加一些样式&#xff0c;就在head元素上挂载一个style元素。 然后&#xff0c;写样式表&#xff1a; 效…

HTML写一个简单网页

最近学习了一点HTML&#xff0c;闲来无事写个网页看看&#xff0c; 欢迎、改进、留言。 演示地点&#xff1a;跳转到演示地点 一、初始化页面 body,button,dd,dl, dt,form, h1, h2, h3, h4, h5, h6, hr, input, legend, li, ol, p, pre, td, textarea, th, ul,a,div,span {m…

HTML-01-最简单的网页

一、&#xff08;1&#xff09; 首先&#xff0c;新建一个文本文档 &#xff08;2&#xff09;完成后&#xff0c;在里面输入你想写入的内容 &#xff08;3&#xff09;最后&#xff0c;把文件拓展名改为html&#xff0c;更改之后&#xff0c;我们会发现文本图标会变成浏览器的…

如何用html制作一个简单的网页

哈喽&#xff0c;大家好&#xff01;我是小张。大家在浏览网页的时候有没有好奇过这个网页是怎么制作&#xff0c;其实只是制作一个简单的网页是很简单的。今天我就教一下大家如何用HTML制作一个简单的网页。 了解html 1. 学习html之前先要知道html是什么 HTML的全称为超文本标…

制作一个简单的网页(入门篇)

使用HTML和CSS来制作一个简单的网页 前言一、HTML1.1常见元素介绍1.2借助工具&#xff0c;浏览器开发者工具 二、实现个人名片1.基本框架2.使用CSS美化1.CSS书写位置1、以元素的style 属性来指定 &#xff08;内联样式&#xff09;2、以style 标签包裹 &#xff08;内部样式&am…

一个简单的HTML网页

一个简单的HTML网页&#xff0c;这是朋友写的&#xff0c;里面没有什么内容的&#xff0c;和大家分享一下&#xff0c;不喜勿喷。 先看下效果图 这里的登录和注册都是没有实际功能的&#xff0c;只是一个样式 下面来看看代码 登录 <!DOCTYPE html> <html><h…

return的使用方法

这里是修真院前端小课堂&#xff0c;每篇分享文从 【背景介绍】【知识剖析】【常见问题】【解决方案】【编码实战】【扩展思考】【更多讨论】【参考文献】 八个方面深度解析前端知识/技能&#xff0c;本篇分享的是&#xff1a; 【return的使用方法 】 今天给大家分享一下&am…

if中return的用法

C#编程中&#xff0c;在if语句中&#xff0c;使用return语句&#xff0c;用于退出该if语句所在类的所在方法。例如程序&#xff1a; namespace RETU {class Program{static void Main(string[] args){IFR ifr new IFR();ifr.Kan();//Console.Read();}}class IFR{public stati…

【Java SE】return的用法(快速扫盲)

&#x1f389;&#x1f389;&#x1f389;点进来你就是我的人了博主主页&#xff1a;&#x1f648;&#x1f648;&#x1f648;戳一戳,欢迎大佬指点! 欢迎志同道合的朋友一起加油喔&#x1f93a;&#x1f93a;&#x1f93a; 目录 前言 1.定义 2.return的用法 3.break和retur…

python中 return 的用法

# 说明&#xff1a; 1&#xff0c;return 语句后面跟的表达式可以省略&#xff0c;省略后相当于 &#xff08;返回&#xff09;return None # 2&#xff0c;如果函数没有retur…

Java中return的两种用法

一、return语句总是用在方法中&#xff0c;有两个作用。 一个是返回方法指定类型的值&#xff08;这个值总是确定的&#xff09;。 一个是结束方法的执行&#xff08;仅仅一个return语句&#xff09;。 一般的就百是用在有反回值的方法中&#xff0c;用来返回方度法指定问类…

return的四种用法

return的四种用法 &#xff08;1&#xff09;return跳出函数 def num1():print(欢迎练习return !)print(hello!) num1() #跳出函数&#xff1a; def num1():print(欢迎练习return !)returnprint(hello!) num1()(2)return从函数返回一个值&#xff0c;并且这个值可以赋值给他变…

C语言中return的各种用法

按初学的理解&#xff0c;return的任务就是返回对应的参数&#xff0c;在外层函数中对这个参数做进一步处理。 实际上return的用法不只这些。 为调用的函数返回参数值 此类应用最为普遍&#xff0c;通常是在一个具有返回值的函数中&#xff0c;返回一个参数值&#xff0c;这个返…

个人公众号,多谢关注

个人公众号,多谢关注!

Java用BufferedImage处理图片实例

最近&#xff0c;项目中需要对图片进行处理。实现的方式当然有很多种&#xff0c;这里&#xff0c;我使用了Java的BufferedImage进行了实现。由于对图片的不熟悉&#xff0c;实现的时候费了点儿劲&#xff0c;这里记录一下&#xff0c;以备后用。 场景描述&#xff1a;其实问题…