摘要:<!DOCTYPE html> <html lang = "en"> <head> <meta charset = "UTF-8"> <ti
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "UTF-8">
<title>浮动--导航</title>
<link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<style>
* {
margin: 0;
padding: 0;
}
body {
background: #F3F5F7;
margin-top: -10px;
}
.clear {
clear: both;
}
/*顶部导航*/
.top-nav {
width: 100%;
margin-bottom: 30px;
background: #333;
}
#top-nav > li {
list-style: none;
width: 96px;
height: 60px;
line-height: 60px;
text-align: center;
float: left;
cursor: pointer;
box-sizing: border-box;
}
/*边框线的小绿条*/
.bottom-line {
border-bottom: 5px solid forestgreen;
}
#top-nav > li > a {
font-size: 14px;
color: #CCC;
text-decoration: none;
}
#logo {
margin-right: 100px;
}
#logo img {
width: 140px;
height: 60px;
}
.active {
background: rgba(200, 200, 200, 0.2);
}
#top-nav #msg {
width: 120px;
float: right;
margin-right: 20px;
}
#top-nav #msg a {
display: inline-block;
width: 60px;
height: 60px;
float: left;
}
#top-nav #msg img {
width: 30px;
height: 30px;
border-radius: 50%;
vertical-align: top;
position: relative;
top: 15px;
}
.glyphicon {
font-size: 20px;
vertical-align: top;
position: relative;
top: 20px;
}
.small {
font-size: 12px;
top: 24px;
}
.red {
width: 8px;
height: 8px;
border-radius: 50%;
background: red;
display: inline-block;
position: relative;
left: 2px;
bottom: 5px;
}
#msg-icon:hover {
background: #555;
}
.more {
width: 250px;
background: #FFF;
box-shadow: 0 2px 3px #CCC;
text-align: left;
display: none;
position: relative;
/*z-index仅在定位元素上生效*/
z-index: 9;
}
.more li {
list-style: none;
width: 125px;
height: 40px;
line-height: 40px;
float: left;
box-sizing: border-box;
padding-left: 10px;
}
.more li a {
text-decoration: none;
color: #000;
}
.more li:hover {
background: #DDD;
}
/*轮播图区域*/
.carousel {
width: 1200px;
height: 510px;
margin: 0 auto;
border-radius: 10px;
box-shadow: 4px 4px 10px #CCC;
}
/*轮播图左侧导航*/
.carousel-left {
width: 200px;
height: 510px;
background: #2B333B;
float: left;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
padding-top: 15px;
}
.carousel-left a {
display: block;
color: #CCC;
font-size: 16px;
text-decoration: none;
height: 60px;
line-height: 60px;
padding-left: 25px;
}
.carousel-left .glyphicon {
font-size: 12px;
float: right;
right: 15px;
top: 23px;
}
.carousel-left a:hover {
background: rgba(200, 200, 200, 0.4);
}
/*轮播图右侧*/
.carousel-right {
width: 1000px;
height: 510px;
float: left;
background: #FFF;
border-bottom-right-radius: 10px;
border-top-right-radius: 10px;
}
/*轮播图右侧顶部导航*/
.carousel-right-top {
height: 60px;
padding-left: 15px;
border-top-right-radius: 10px;
position: relative;
}
.carousel-right-top ul {
margin-bottom: 0;
list-style: none;
}
.carousel-right-top ul li {
float: left;
width: 100px;
line-height: 60px;
text-align: center;
}
.carousel-right-top ul li a {
font-size: 14px;
color: #111;
text-decoration: none;
}
.carousel-right-top .new {
color: #FFF;
display: inline-block;
font-size: 12px;
width: 19px;
height: 18px;
line-height: 18px;
background: #FF5722;
margin-left: 3px;
border-radius: 2px;
}
.carousel-right-top input {
width: 260px;
height: 40px;
line-height: 40px;
background: #EEE;
font-size: 12px;
padding-left: 10px;
border-radius: 3px;
border: none;
outline: none;
position: absolute;
right: 5px;
top: 10px;
}
.carousel-right-top .glyphicon {
font-size: 18px;
color: #AAA;
position: absolute;
right: 15px;
top: 21px;
cursor: pointer;
}
.carousel-right-top ul li a:hover {
color: #999;
}
/*轮播图*/
.carousel-right-img {
height: 338px;
position: relative;
overflow: hidden;
}
/*轮播图左右按钮*/
.carousel-right-img .btn {
color: #FFF;
width: 36px;
height: 36px;
border-radius: 50%;
background: rgba(0, 0, 0, 0.3);
position: absolute;
top: 151px;
z-index: 9;
}
.carousel-right-img .btn-left {
left: 15px;
}
.carousel-right-img .btn-right {
right: 15px;
}
.carousel-right-img .glyphicon {
top: 0;
left: -5px;
}
/*底部小圆点 */
.dot {
position: absolute;
left: 45%;
bottom: 30px;
z-index: 9;
}
.dot span {
display: inline-block;
width: 14px;
height: 14px;
background: rgba(0, 0, 0, 0.3);
border-radius: 50%;
margin-left: 5px;
}
.dot .active {
background: rgba(255, 255, 255, 0.5);
}
/*轮播图片*/
.carousel-right-img .carousel-img {
position: absolute;
}
/*小图*/
.carousel-right-bottom {
height: 112px;
line-height: 112px;
}
.carousel-right-bottom .img-small {
width: 236px;
height: 90px;
margin-left: 9px;
}
.carousel-right-bottom .img-small img {
border-radius: 5px;
}
</style>
</head>
<body>
<!--顶部导航-->
<div class = "top-nav">
<ul id = "top-nav">
<li id = "logo"><a href = ""><img src = "http://www.php.cn/static/images/logo.png" alt = ""></a></li>
<li class = "active item" name = "0"><a href = "">首页</a></li>
<li class = "item" name = "1"><a href = "">视频教程</a></li>
<li class = "item" name = "2"><a href = "">社区问答</a></li>
<li class = "item" name = "3">
<a href = "">编程词典 <span class = "glyphicon glyphicon-triangle-bottom small"></span></a>
<ul class = "more">
<li><a href = "">php词典</a></li>
<li><a href = "">技术文章</a><span class = "red"></span></li>
<li><a href = "">CSS词典</a></li>
<li><a href = "">小程序开发</a></li>
<li><a href = "">技术文章</a></li>
<li><a href = "">技术文章</a></li>
<li><a href = "">Javascript词典</a></li>
<li><a href = "">技术文章</a></li>
<div class = "clear"></div>
</ul>
</li>
<li class = "item" name = "4"><a href = "">手册下载</a></li>
<li class = "item" name = "5"><a href = "">工具下载</a></li>
<li class = "item" name = "6"><a href = "">类库下载</a></li>
<li class = "item" name = "7"><a href = "">特色教程</a><span class = "red"></span></li>
<li class = "item" name = "8"><a href = "">菜鸟学堂</a></li>
<li id = "msg">
<a href = "" id = "msg-icon"><span class = "glyphicon glyphicon-volume-up" aria-hidden = "true"></span></a>
<a href = ""><img src = "http://img.php.cn/upload/avatar/000/369/589/5c403927cc95b343.jpg"></a>
</li>
<p class = "line"></p>
<div class = "clear"></div>
</ul>
</div>
<!--轮播图区域 carousel [karəˈsel] 轮播-->
<div class = "carousel">
<!--轮播左侧导航-->
<div class = "carousel-left">
<a href = "">php开发
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">前端开发
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">服务器端开发
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">移动开发
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">数据库
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">服务器运维&下载
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">在线工具箱
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
<a href = "">常用类库
<span class = "glyphicon glyphicon-menu-right"></span>
</a>
</div>
<!--轮播右侧-->
<div class = "carousel-right">
<!--轮播图上方导航-->
<div class = "carousel-right-top">
<ul>
<li><a href = "">PHP头条</a><span class = "new">新</span></li>
<li><a href = "">独孤九贱</a></li>
<li><a href = "">学习路线</a><span class = "new" style = "background: #2F4056;">新</span></li>
<li><a href = "">在线工具</a></li>
<li><a href = "">趣味课堂.</a><span class = "new" style = "background: #FFB800;">新</span></li>
<li><a href = "">社区问答</a></li>
<li><a href = "">课程直播</a></li>
</ul>
<input type = "text" class = "search" placeholder = "输入关键词搜索">
<span class = "glyphicon glyphicon-search"></span>
</div>
<!--轮播图-->
<div class = "carousel-right-img">
<!--左右按钮-->
<div class = "btn btn-left"><span class = "glyphicon glyphicon-menu-left"></span></div>
<div class = "btn btn-right"><span class = "glyphicon glyphicon-menu-right"></span></div>
<!--下方圆点-->
<div class = "dot"><span class = "active"></span></div>
<!--图片区域-->
<a href = "" class = "carousel-img">
<img src = "https://img.php.cn/upload/article/000/000/003/5a9675a3b2106284.jpg">
</a>
<a href = "" class = "carousel-img" style = "left: 1000px;">
<img src = "https://img.php.cn/upload/article/000/000/003/5b49b0e610f26951.jpg" alt = "">
</a>
<a href = "" class = "carousel-img" style = "left: 2000px;">
<img src = "https://img.php.cn/upload/article/000/000/003/5a9675a3b2106284.jpg" alt = "">
</a>
<a href = "" class = "carousel-img" style = "left: 3000px;">
<img src = "https://img.php.cn/upload/article/000/000/003/5b49b0e610f26951.jpg" alt = "">
</a>
</div>
<!--下方小图-->
<div class = "carousel-right-bottom">
<a href = "" class = "img-small">
<img src = "http://www.php.cn/static/images/index_dugu2.jpg" alt = "">
</a>
<a href = "" class = "img-small">
<img src = "http://www.php.cn/static/images/index_dugu2.jpg" alt = "">
</a>
<a href = "" class = "
批改老师:韦小宝批改时间:2019-02-11 09:28:57
老师总结:写的很不错 对于我个人而言,下拉部分使用纯css就可以搞定了,并不需要使用js方面的东西!