帮我写一段双飞翼和二级菜单栏还有轮播图的代码 加注释
时间: 2024-05-27 18:13:40 浏览: 91
<!DOCTYPE html>
<html>
<head>
<title>双飞翼布局</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
body{
font: 14px/1.5 Arial, sans-serif;
}
.container{
width: 1000px;
margin: 0 auto;
position: relative;
}
.header{
height: 100px;
background-color: #ccc;
position: relative;
}
.content{
float: left;
width: 100%;
}
.content-main{
float: left;
width: 70%;
background-color: #fff;
padding: 20px;
box-sizing: border-box;
}
.content-left{
float: left;
width: 20%;
background-color: #f5f5f5;
padding: 20px;
box-sizing: border-box;
}
.content-right{
float: left;
width: 10%;
background-color: #f5f5f5;
padding: 20px;
box-sizing: border-box;
}
.clearfix:after{
content: "";
display: block;
clear: both;
height: 0;
visibility: hidden;
}
.footer{
height: 50px;
background-color: #ccc;
position: relative;
clear: both;
}
/* 二级菜单栏样式 */
.nav{
background-color: #333;
height: 40px;
line-height: 40px;
}
.nav ul{
margin: 0;
padding: 0;
list-style: none;
}
.nav li{
float: left;
position: relative;
}
.nav li a{
display: block;
padding: 0 20px;
color: #fff;
text-decoration: none;
}
.nav li:hover{
background-color: #666;
}
/* 二级菜单栏下拉菜单样式 */
.nav ul ul{
position: absolute;
top: 40px;
left: 0;
display: none;
}
.nav ul li:hover > ul{
display: block;
}
.nav ul ul li{
float: none;
width: 200px;
background-color: #444;
position: relative;
border-bottom: 1px solid #222;
}
.nav ul ul ul li{
position: relative;
top: -60px;
left: 200px;
}
.nav li:hover > ul{
display: block;
}
/* 轮播图样式 */
.carousel{
width: 1000px;
height: 300px;
margin: 20px 0;
position: relative;
overflow: hidden;
}
.carousel ul{
list-style: none;
position: relative;
width: 5000px;
height: 300px;
left: 0;
animation: carousel 20s infinite linear;
}
.carousel li{
float: left;
position: relative;
width: 1000px;
height: 300px;
}
.carousel img{
width: 100%;
height: 100%;
}
/* 轮播动画 */
@keyframes carousel{
0%{
left: 0;
}
20%{
left: -1000px;
}
40%{
left: -2000px;
}
60%{
left: -3000px;
}
80%{
left: -4000px;
}
100%{
left: -5000px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<header>
<h1>双飞翼布局</h1>
</header>
</div>
<nav class="nav clearfix">
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">产品中心</a>
<ul>
<li><a href="#">产品分类1</a></li>
<li><a href="#">产品分类2</a></li>
<li><a href="#">产品分类3</a></li>
<li><a href="#">产品分类4</a></li>
</ul>
</li>
<li><a href="#">关于我们</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</nav>
<div class="content clearfix">
<main class="content-main">
<h2>欢迎使用双飞翼布局</h2>
<p>这是一种流行的页面布局,它可以在不使用表格的情况下实现三栏布局。它使用了负边距来使左右两栏与中间主要内容区域水平对齐。</p>
</main>
<div class="content-left">
<h2>左侧栏目</h2>
<p>这里是左侧栏目的内容</p>
</div>
<div class="content-right">
<h2>右侧栏目</h2>
<p>这里是右侧栏目的内容</p>
</div>
</div>
<div class="carousel">
<ul>
<li><img src="https://via.placeholder.com/1000x300?text=Carousel+Image+1" alt=""></li>
<li><img src="https://via.placeholder.com/1000x300?text=Carousel+Image+2" alt=""></li>
<li><img src="https://via.placeholder.com/1000x300?text=Carousel+Image+3" alt=""></li>
<li><img src="https://via.placeholder.com/1000x300?text=Carousel+Image+4" alt=""></li>
<li><img src="https://via.placeholder.com/1000x300?text=Carousel+Image+5" alt=""></li>
</ul>
</div>
<div class="footer">
<footer>
<p>版权所有 © 2021</p>
</footer>
</div>
</div>
</body>
</html>
阅读全文