一个网站实现以下内容: 写一个包括五个超链接的导航导航内容包括首页视频图片音乐关于宽度为100然后再加上一个论播可以换五张图片每一张图片轮流三秒可以点击点切换到自己要切换到论播图片上然后下面再标签界面长度100px再下面写1500px的视频区视频区里面写一个视频区然后下面满满的video每行5个视频再加上一个输入文字栏里面写入的东西直接来到2869563610qqcom这个邮箱再加上可以利用QQ登
实现以上功能可以使用HTML、CSS和JavaScript语言,具体实现步骤如下:
- 编写HTML代码,包括导航栏、轮播图、标签界面、视频区、视频列表和输入文字栏等内容。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>网站标题</title>
<style>
/* 样式表 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
nav {
width: 100%;
background-color: #333;
color: #fff;
text-align: center;
padding: 10px 0;
}
nav a {
color: #fff;
text-decoration: none;
padding: 0 20px;
}
nav a:hover {
background-color: #fff;
color: #333;
}
.slider {
width: 100%;
height: 300px;
position: relative;
overflow: hidden;
}
.slider img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: none;
}
.slider img.active {
display: block;
}
.slider .dots {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
}
.slider .dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #999;
margin: 0 5px;
cursor: pointer;
}
.slider .dot.active {
background-color: #fff;
}
.tags {
width: 100%;
height: 100px;
background-color: #eee;
padding: 10px;
box-sizing: border-box;
}
.video {
width: 100%;
height: 1500px;
background-color: #fff;
padding: 10px;
box-sizing: border-box;
}
.video-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 10px;
}
.video-item {
width: 18%;
margin-bottom: 10px;
box-shadow: 0 0 10px rgba(0,0,0,.3);
}
.video-item img {
width: 100%;
height: 120px;
object-fit: cover;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.video-item .title {
padding: 5px;
font-size: 14px;
font-weight: bold;
text-align: center;
background-color: #333;
color: #fff;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.input {
width: 100%;
height: 100px;
background-color: #eee;
padding: 10px;
box-sizing: border-box;
}
.input label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.input input {
width: 100%;
height: 30px;
padding: 5px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,.3);
}
.input textarea {
width: 100%;
height: 50px;
padding: 5px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,.3);
}
.input button {
width: 100%;
height: 40px;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.input button:hover {
background-color: #fff;
color: #333;
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav>
<a href="#">首页</a>
<a href="#">视频</a>
<a href="#">图片</a>
<a href="#">音乐</a>
<a href="#">关于</a>
</nav>
<!-- 轮播图 -->
<div class="slider">
<img src="img/1.jpg" class="active">
<img src="img/2.jpg">
<img src="img/3.jpg">
<img src="img/4.jpg">
<img src="img/5.jpg">
<div class="dots">
<span class="dot active" data-index="1"></span>
<span class="dot" data-index="2"></span>
<span class="dot" data-index="3"></span>
<span class="dot" data-index="4"></span>
<span class="dot" data-index="5"></span>
</div>
</div>
<!-- 标签界面 -->
<div class="tags">
标签1 | 标签2 | 标签3 | 标签4 | 标签5
</div>
<!-- 视频区 -->
<div class="video">
<h2>视频区</h2>
<div class="video-list">
<div class="video-item">
<img src="img/1.jpg">
<div class="title">视频标题1</div>
</div>
<div class="video-item">
<img src="img/2.jpg">
<div class="title">视频标题2</div>
</div>
<div class="video-item">
<img src="img/3.jpg">
<div class="title">视频标题3</div>
</div>
<div class="video-item">
<img src="img/4.jpg">
<div class="title">视频标题4</div>
</div>
<div class="video-item">
<img src="img/5.jpg">
<div class="title">视频标题5</div>
</div>
<div class="video-item">
<img src="img/6.jpg">
<div class="title">视频标题6</div>
</div>
<div class="video-item">
<img src="img/7.jpg">
<div class="title">视频标题7</div>
</div>
<div class="video-item">
<img src="img/8.jpg">
<div class="title">视频标题8</div>
</div>
<div class="video-item">
<img src="img/9.jpg">
<div class="title">视频标题9</div>
</div>
<div class="video-item">
<img src="img/10.jpg">
<div class="title">视频标题10</div>
</div>
</div>
</div>
<!-- 输入文字栏 -->
<div class="input">
<form>
<label for="name">姓名:</label>
<input type="text" id="name" name="name">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email">
<label for="message">留言:</label>
<textarea id="message" name="message"></textarea>
<button type="submit">提交</button>
</form>
</div>
<!-- QQ登录 -->
<p>使用QQ登录:</p>
<a href="https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=YOUR_APP_ID&redirect_uri=YOUR_REDIRECT_URI&scope=get_user_info&state=STATE">
<img src="https://qzonestyle.gtimg.cn/qzone/vas/opensns/res/img/Connect_logo_5.png">
</a>
</body>
</html>
- 编写JavaScript代码,实现轮播图的切换和点击点切换图片功能。
// 获取轮播图和点元素
var slider = document.querySelector('.slider');
var images = slider.querySelectorAll('img');
var dots = slider.querySelectorAll('.dot');
// 设置轮播图切换定时器
var index = 0;
var interval = setInterval(function() {
images[index].classList.remove('active');
dots[index].classList.remove('active');
index = (index + 1) % images.length;
images[index].classList.add('active');
dots[index].classList.add('active');
}, 3000);
// 点击点切换图片
dots.forEach(function(dot) {
dot.addEventListener('click', function() {
var currentIndex = index;
index = parseInt(dot.dataset.index) - 1;
images[currentIndex].classList.remove('active');
dots[currentIndex].classList.remove('active');
images[index].classList.add('active');
dots[index].classList.add('active');
clearInterval(interval);
interval = setInterval(function() {
images[index].classList.remove('active');
dots[index].classList.remove('active');
index = (index + 1) % images.length;
images[index].classList.add('active');
dots[index].classList.add('active');
}, 3000);
});
});
- 编写CSS代码,实现页面布局和样式。
/* 样式表 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
nav {
width: 100%;
background-color: #333;
color: #fff;
text-align: center;
padding: 10px 0;
}
nav a {
color: #fff;
text-decoration: none;
padding: 0 20px;
}
nav a:hover {
background-color: #fff;
color: #333;
}
.slider {
width: 100%;
height: 300px;
position: relative;
overflow: hidden;
}
.slider img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: none;
}
.slider img.active {
display: block;
}
.slider .dots {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
}
.slider .dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #999;
margin: 0 5px;
cursor: pointer;
}
.slider .dot.active {
background-color: #fff;
}
.tags {
width: 100%;
height: 100px;
background-color: #eee;
padding: 10px;
box-sizing: border-box;
}
.video {
width: 100%;
height: 1500px;
background-color: #fff;
padding: 10px;
box-sizing: border-box;
}
.video-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 10px;
}
.video-item {
width: 18%;
margin-bottom: 10px;
box-shadow: 0 0 10px rgba(0,0,0,.3);
}
.video-item img {
width: 100%;
height: 120px;
object-fit: cover;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.video-item .title {
padding: 5px;
font-size: 14px;
font-weight: bold;
text-align: center;
background-color: #333;
color: #fff;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.input {
width: 100%;
height: 100px;
background-color: #eee;
padding: 10px;
box-sizing: border-box;
}
.input label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.input input {
width: 100%;
height: 30px;
padding: 5px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,.3);
}
.input textarea {
width: 100%;
height: 50px;
padding: 5px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,.3);
}
.input button {
width: 100%;
height: 40px;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.input button:hover {
background-color: #fff;
color: #333;
}
- 在QQ互联开放平台注册应用,获取APP ID和重定向URI,将其替换到HTML代码中的相应位置。
<!-- QQ登录 -->
<p>使用QQ登录:</p>
<a href="https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=YOUR_APP_ID&redirect_uri=YOUR_REDIRECT_URI&scope=get_user_info&state=STATE">
<img src="https://qzonestyle.gtimg.cn/qzone/vas/opensns/res/img/Connect_logo_5.png">
</a>
- 在服务器上部署网站,并配置SMTP服务器和邮箱账号,以便收取用户在输入文字栏中输入的内容。
至此,一个包括导航栏、轮播图、标签界面、视频区、视频列表、输入文字栏和QQ登录等功能的网站就完成了。用户可以通过导航栏浏览网站的各个页面,观看视频和留言等
原文地址: https://www.cveoy.top/t/topic/fEBx 著作权归作者所有。请勿转载和采集!