news 2026/6/1 19:25:32

HTML网页仿写实验

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
HTML网页仿写实验

实验代码:

<!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>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Microsoft Yahei", sans-serif;
}
.top-header {
background-color: #0a2463;
padding: 12px 40px;
display: flex;
align-items: center;
justify-content: space-between;
}
.logo-title {
display: flex;
align-items: center;
gap: 12px;
}
.logo {
width: 48px;
height: 48px;
border-radius: 50%;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
color: #0a2463;
font-weight: bold;
font-size: 20px;
}
.title-group h1 {
color: #fff;
font-size: 20px;
font-weight: 600;
}
.title-group p {
color: #d0d0d0;
font-size: 12px;
}
.search-box {
display: flex;
align-items: center;
gap: 4px;
}
.search-input {
height: 32px;
padding: 0 8px;
border: none;
border-radius: 4px;
outline: none;
}
.search-btn {
height: 32px;
width: 32px;
background-color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.nav-menu {
background-color: #0f3486;
}
.nav-menu ul {
list-style: none;
display: flex;
justify-content: space-around;
}
.nav-menu li a {
display: block;
color: #fff;
text-decoration: none;
padding: 12px 20px;
font-size: 14px;
}
.nav-menu li a:hover {
background-color: #1a4ba0;
}
.banner-container {
position: relative;
height: 300px;
overflow: hidden;
}
.banner-item {
background-color: #d62828;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 400"><path fill="rgba(255,255,255,0.1)" d="M0,0L1920,120L1920,400L0,400Z"/></svg>');
background-size: cover;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #fff;
position: absolute;
top: 0;
left: 0;
width: 100%;
opacity: 0;
transition: opacity 0.5s ease;
}
.banner-item.active {
opacity: 1;
z-index: 1;
}
.banner-item::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.15);
}
.banner-item h2 {
font-size: 42px;
margin-bottom: 30px;
z-index: 1;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.banner-item p {
font-size: 32px;
z-index: 1;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.banner-dots {
position: absolute;
bottom: 20px;
z-index: 2;
display: flex;
gap: 8px;
left: 50%;
transform: translateX(-50%);
}
.banner-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background-color: rgba(255,255,255,0.5);
cursor: pointer;
transition: background-color 0.3s ease;
}
.banner-dot.active {
background-color: #fff;
}
</style>
</head>
<body>
<header class="top-header">
<div class="logo-title">
<div class="logo">X</div>
<div class="title-group">
<h1>XX理工学院质量管理与评估中心</h1>
<p>Quality Management and Evaluation Center, XX College of Technology</p>
</div>
</div>
<div class="search-box">
<input type="text" class="search-input" placeholder="搜索...">
<button class="search-btn">🔍</button>
</div>
</header>

<nav class="nav-menu">
<ul>
<li><a href="#">网站首页</a></li>
<li><a href="#">机构设置</a></li>
<li><a href="#">质量监控</a></li>
<li><a href="#">教学评估</a></li>
<li><a href="#">文件制度</a></li>
<li><a href="#">下载中心</a></li>
<li><a href="#">学校首页</a></li>
</ul>
</nav>

<section class="banner-container">
<div class="banner-item active">
<h2>高举中国特色社会主义伟大旗帜</h2>
<p>为全面建设社会主义现代化国家而团结奋斗</p>
</div>
<div class="banner-item">
<h2>深化教育教学改革</h2>
<p>全面提升人才培养质量</p>
</div>
<div class="banner-item">
<h2>XX理工学院欢迎您</h2>
<p>厚德博学 格物致知</p>
</div>
<div class="banner-dots">
<span class="banner-dot active"></span>
<span class="banner-dot"></span>
<span class="banner-dot"></span>
</div>
</section>

<script>
const bannerItems = document.querySelectorAll('.banner-item');
const bannerDots = document.querySelectorAll('.banner-dot');
const bannerContainer = document.querySelector('.banner-container');
let currentIndex = 0;
let timer = null;

function switchBanner(index) {
bannerItems.forEach(item => item.classList.remove('active'));
bannerDots.forEach(dot => dot.classList.remove('active'));
bannerItems[index].classList.add('active');
bannerDots[index].classList.add('active');
currentIndex = index;
}

function autoPlay() {
timer = setInterval(() => {
let nextIndex = (currentIndex + 1) % bannerItems.length;
switchBanner(nextIndex);
}, 5000);
}

bannerDots.forEach((dot, index) => {
dot.addEventListener('click', () => {
clearInterval(timer);
switchBanner(index);
autoPlay();
});
});

bannerContainer.addEventListener('mouseenter', () => {
clearInterval(timer);
});
bannerContainer.addEventListener('mouseleave', () => {
autoPlay();
});

autoPlay();
</script>
</body>
</html>

<!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> * { margin: 0; padding: 0; box-sizing: border-box; font-family: "Microsoft Yahei", sans-serif; } .top-header { background-color: #0a2463; padding: 12px 40px; display: flex; align-items: center; justify-content: space-between; } .logo-title { display: flex; align-items: center; gap: 12px; } .logo { width: 48px; height: 48px; border-radius: 50%; background-color: #fff; display: flex; align-items: center; justify-content: center; color: #0a2463; font-weight: bold; font-size: 20px; } .title-group h1 { color: #fff; font-size: 20px; font-weight: 600; } .title-group p { color: #d0d0d0; font-size: 12px; } .search-box { display: flex; align-items: center; gap: 4px; } .search-input { height: 32px; padding: 0 8px; border: none; border-radius: 4px; outline: none; } .search-btn { height: 32px; width: 32px; background-color: #fff; border: none; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; } .nav-menu { background-color: #0f3486; } .nav-menu ul { list-style: none; display: flex; justify-content: space-around; } .nav-menu li a { display: block; color: #fff; text-decoration: none; padding: 12px 20px; font-size: 14px; } .nav-menu li a:hover { background-color: #1a4ba0; } .banner-container { position: relative; height: 300px; overflow: hidden; } .banner-item { background-color: #d62828; background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 400"><path fill="rgba(255,255,255,0.1)" d="M0,0L1920,120L1920,400L0,400Z"/></svg>'); background-size: cover; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; position: absolute; top: 0; left: 0; width: 100%; opacity: 0; transition: opacity 0.5s ease; } .banner-item.active { opacity: 1; z-index: 1; } .banner-item::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.15); } .banner-item h2 { font-size: 42px; margin-bottom: 30px; z-index: 1; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); } .banner-item p { font-size: 32px; z-index: 1; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); } .banner-dots { position: absolute; bottom: 20px; z-index: 2; display: flex; gap: 8px; left: 50%; transform: translateX(-50%); } .banner-dot { width: 12px; height: 12px; border-radius: 50%; background-color: rgba(255,255,255,0.5); cursor: pointer; transition: background-color 0.3s ease; } .banner-dot.active { background-color: #fff; } </style> </head> <body> <header class="top-header"> <div class="logo-title"> <div class="logo">X</div> <div class="title-group"> <h1>XX理工学院质量管理与评估中心</h1> <p>Quality Management and Evaluation Center, XX College of Technology</p> </div> </div> <div class="search-box"> <input type="text" class="search-input" placeholder="搜索..."> <button class="search-btn">🔍</button> </div> </header> <nav class="nav-menu"> <ul> <li><a href="#">网站首页</a></li> <li><a href="#">机构设置</a></li> <li><a href="#">质量监控</a></li> <li><a href="#">教学评估</a></li> <li><a href="#">文件制度</a></li> <li><a href="#">下载中心</a></li> <li><a href="#">学校首页</a></li> </ul> </nav> <section class="banner-container"> <div class="banner-item active"> <h2>高举中国特色社会主义伟大旗帜</h2> <p>为全面建设社会主义现代化国家而团结奋斗</p> </div> <div class="banner-item"> <h2>深化教育教学改革</h2> <p>全面提升人才培养质量</p> </div> <div class="banner-item"> <h2>XX理工学院欢迎您</h2> <p>厚德博学 格物致知</p> </div> <div class="banner-dots"> <span class="banner-dot active"></span> <span class="banner-dot"></span> <span class="banner-dot"></span> </div> </section> <script> const bannerItems = document.querySelectorAll('.banner-item'); const bannerDots = document.querySelectorAll('.banner-dot'); const bannerContainer = document.querySelector('.banner-container'); let currentIndex = 0; let timer = null; function switchBanner(index) { bannerItems.forEach(item => item.classList.remove('active')); bannerDots.forEach(dot => dot.classList.remove('active')); bannerItems[index].classList.add('active'); bannerDots[index].classList.add('active'); currentIndex = index; } function autoPlay() { timer = setInterval(() => { let nextIndex = (currentIndex + 1) % bannerItems.length; switchBanner(nextIndex); }, 5000); } bannerDots.forEach((dot, index) => { dot.addEventListener('click', () => { clearInterval(timer); switchBanner(index); autoPlay(); }); }); bannerContainer.addEventListener('mouseenter', () => { clearInterval(timer); }); bannerContainer.addEventListener('mouseleave', () => { autoPlay(); }); autoPlay(); </script> </body> </html>

代码运行结果:

注:

本次代码仿写仅实现某网站导航页的部分功能,例如轮播以及搜索栏、导航栏;但未实现图片插入和内嵌抽屉功能。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/28 12:06:01

GBDT 回归任务生成过程(逐步计算演示)

GBDT 是 Gradient Boosting Decision Tree 的缩写&#xff0c;中文名为梯度提升决策树&#xff0c;是一种经典的集成学习算法&#xff0c;核心逻辑是 串行生成多棵 CART 回归树&#xff0c;每一棵新树都用来拟合前一轮模型的预测残差&#xff0c;最终将所有树的预测结果累加&am…

作者头像 李华
网站建设 2026/5/29 22:21:46

基于Android的智能旅游管家的设计与实现(源码+lw+部署文档+讲解等)

课题介绍 本课题旨在设计实现基于Android的智能旅游管家APP&#xff0c;针对传统旅游中行程规划繁琐、景点信息零散、线下服务对接滞后、应急处理不便等痛点&#xff0c;打造集行程规划、智能导览、服务预约、应急保障于一体的移动旅游服务工具&#xff0c;实现旅游全流程数字化…

作者头像 李华
网站建设 2026/5/29 22:07:53

《AI元人文:悟空而行》的作者说明

《AI元人文&#xff1a;悟空而行》的作者说明 作者说明 尊敬的评审专家、主编&#xff1a; 在审阅《知行合一的价值革命&#xff1a;评〈AI元人文&#xff1a;悟空而行〉的思想、方法与伦理突破》及它所评论的原作《AI元人文&#xff1a;悟空而行》之前&#xff0c;恳请您允许作…

作者头像 李华
网站建设 2026/5/29 16:14:07

智能体设计模式全景总结:21个模式快速串联指南

智能体设计模式全景总结&#xff1a;21个模式快速串联指南 &#x1f3af; 本文档是《Agentic Design Patterns》21个设计模式的快速串联总结&#xff0c;帮你建立完整的知识体系&#xff0c;快速理解各模式之间的关系和演进路径。 &#x1f4da; 目录导航 一、设计模式全景图二…

作者头像 李华
网站建设 2026/5/30 20:17:07

导师推荐10个AI论文写作软件,本科生轻松搞定毕业论文!

导师推荐10个AI论文写作软件&#xff0c;本科生轻松搞定毕业论文&#xff01; AI 工具助力论文写作&#xff0c;让毕业不再焦虑 对于许多本科生来说&#xff0c;撰写毕业论文是一项既重要又令人头疼的任务。从选题、收集资料到撰写初稿、反复修改&#xff0c;每一个环节都可能…

作者头像 李华
网站建设 2026/5/28 19:13:40

仪器仪表智能化以及接入MES流程

目录 一、核心理念&#xff1a;从“哑终端”到“智能节点” 二、仪器仪表智能化的四个层级 三、接入MES的完整流程与架构 流程步骤详解&#xff1a; 四、关键技术要点与挑战 五、价值与收益 总结 仪器仪表智能化及接入MES&#xff08;制造执行系统&#xff09;是智能制造…

作者头像 李华