己制作的,现在只弄了一个首页,后期可能添加详情页,没有css代码,js代码外链了,如不放心可以本地化。
诗梦自己制作
有点丑和有点乱不要在意,只是个人用来放自己喜欢的和用到的网站,源码你们创建个html文件放进去访问就可以了。
代码
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>诗梦-工具站</title>
<meta name='keywords' content='诗梦,博客导航,工具导航,'>
<meta name='description' content='诗梦导航站。'>
<link rel="shortcut icon" href="//m.mom1.cn/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="https://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">
<script type="text/javascript" src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<style>
body{
margin: 0 auto;
text-align: center;
}
.container {
max-width: 580px;
padding: 12px;
margin: 0 auto;
}
</style>
<body>
<body style="background-image: url(https://wx2.sinaimg.cn/mw690/8c534571ly1fdmdspgc5sj20sg0hs0wu.jpg);background-attachment: fixed;background-repeat: no-repeat;background-size: cover;-moz-background-size: cover;">
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right" role="tablist">
<li role="presentation" class="active"><a href="/">首页</a></li>
<li role="presentation" class="active"><a href="https://www.mom1.cn/qq.html">收录</a></li>
</ul>
<h3 class="text-muted" align="left">工具导航</h3>
</div>
<hr>
<div type="button" class="btn btn-primary btn-block" id="start">公告</div><br>
<div class="alert alert-danger" role="alert" style="text-align:left;">
<span class="glyphicon glyphicon-info-sign"></span><strong>申请收录</strong><br>
有好玩的网站,请点击上面申请收录!
</div>
<a type="button" class="btn btn-primary btn-block">博客</a><br>
<a href="http://z.mom1.cn/details/1.html" type="button" class="btn btn-info btn-info">诗 梦 博 客</a>
<a href="http://www.hackv.cn" type="button" class="btn btn-info btn-info">古 韵 博 客</a>
<a href="https://www.qcgzxw.cn/" type="button" class="btn btn-info btn-info">小 文 博 客</a>
<a href="http://72wo.cn" type="button" class="btn btn-info btn-info">往 昔 执 念</a>
<a href="http://z.mom1.cn/details/acgnw.html" type="button" class="btn btn-info">次 元 之 家</a>
<a href="http://z.mom1.cn/details/aeink.html" type="button" class="btn btn-info">墨 渊 博 客</a>
<a href="http://www.mosq.cn/" type="button" class="btn btn-info">森 七 博 客</a>
<a href="http://www.binglinglin.cn/" type="button" class="btn btn-info">冰 凌 博 客</a>
<a href="http://m.mom1.cn" type="button" class="btn btn-info">引 导 单 页</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info">网 页 刷 新</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info">诗 梦 音 乐</a>
<hr>
<a htef="https://www.mom1.cn" type="button" class="btn btn-primary btn-block">工具</a><br>
<a href="http://m.mom1.cn" type="button" class="btn btn-info btn-info">等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info btn-info"> 等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info btn-info">等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info btn-info">等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 等待添加</a>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 等待添加</a>
<hr>
<a type="button" class="btn btn-primary btn-block">友链</a><br>
<a href="https://www.mom1.cn" type="button" class="btn btn-info"> 诗梦博客</a>
<a href="http://m.mom1.cn" type="button" class="btn btn-info"> 诗梦单页</a>
<a href="http://zz.mom1.cn" type="button" class="btn btn-info"> 诗梦音乐</a>
<hr>
<a href="https://www.mom1.cn" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-credit-card"></span> 诗梦</a>
<a href="https://www.mom1.cn" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-exclamation-sign"></span> 帮助</a>
<a href="https://www.mom1.cn/qq.html" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-pencil"></span> 收录</a>
</div>
<br>
© Powered by <a href="https://www.mom1.cn">诗梦博客</a>
</p>
</div>
</body>
</html>
本篇文章主要给大家介绍一下如何使用html+css完成二级横向以及竖向菜单导航制作;菜单导航是网站建设中最常用的一块了,基本每个网站内都会有个导航菜单,用鼠标划过还可以有下拉子菜单。
由上图我们可以看出,该图包含一个横向导航条,然后鼠标经过横向导航条之后,子导航显示出来。
我们这里主要用到的知识点就是列表标签(ul、dl)的使用、浮动(float)的使用、绝对定位(absolute)及鼠标经过(hover)的效果。
1、列表标签ul、dl(我们使用ul、dl来创建同类型的导航元素内容,通过设置css样式来达到图片所示效果);
2、浮动元素float(每个导航元素我们需要使用float:left;让其左对齐,这里涉及到了我们之前讲解的如何清除浮动的影响);
3、绝对定位absolute(对于子导航我们要使用绝对定位来让其浮动在上级有定位元素的下方,不占据元素空间)
4、鼠标经过hover(使用css的鼠标经过元素(hover)效果,配合display的none(隐藏)和block(显示)来实现子菜单的显示与隐藏)
具体的实现html代码以及css代码就如下图所示:
还有一个纵向菜单导航原理跟横向的类似,只需简单调整一下css代码即可。
html代码跟横向一样,这里就不再贴图,具体的实现图片效果以及css代码就如下图所示:
好了,本篇文章就给大家说到这里,大家自己动手写一下看能不能写出一样的页面效果出来,也可以找一些类似的页面自己练习一下,有需要源码的可以直接私信我即可。
每日金句:每天收获小进步,积累起来就是大进步;每天收获小幸福,积攒起来便成大幸福。喜欢我的文章的小伙伴记得关注一下哦,每天将为你更新最新知识。
天无意中看到一个网站的导航条,觉得效果还不错,而且制作也很简单,就自己试着用HTML+CSS做了个一模一样的,下面就把导航条的制作方法及步骤分享给大家!
导航按钮效果图
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>一级导航</title>
<style>/*css样式可以在style里面写*/
body {
margin: 0;/*外边距:分别左,上,右,下都为0,这样就不会出现左右上下间距*/
padding: 0;/*内边距:分别左,上,右,下都为0,这样就不会出现左右上下内间距*/
}
/*第一个div样式*/
#menu {
width: 100%;/*宽度:100%表示浏览器默认宽度*/
height: 45px;/*高度*/
background-color:#FF0033;/*背景颜色:红色*/
}
/*第二个div样式*/
#menu-title {
width: 1000px;
height: 45px;
margin-left: auto;/*margin-left: auto;margin-right: auto;可以把div自动居中*/
margin-right: auto;
}
/*第二个div里面无需列表样式*/
#menu-title ul {/*ul是无序列表*/
margin: 0px;
padding: 0px;
list-style: none;/*列表样式:无*/
}
/*第二个div里面无需列表li样式*/
#menu-title ul li {
width: 142.8px;
height: 45px;
float: left; /*多个li往左浮动*/
line-height: 45px;/*行高*/
text-align: center;/*文本对齐:居中*/
}
/*第二个div里面无需列表li里的a:超链接样式*/
#menu-title ul li a {
color: white; /*颜色:白*/
text-decoration: none;/*文本下划线:无*/
}
/*第二个div里面无需列表li里的a:超链接鼠标经过样式*/
#menu-title ul li:hover {
background-color: #333333;
}
</style>
</head>
<body>
<div id="menu">
<div id="menu-title">
<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>
</div>
</div>
</body>
</html>
以上HTML+CSS代码复制可用。
好多小白不知道怎么搭配颜色,为你们搜集了一下网页颜色搭配工具:http://tool.c7sky.com/webcolor/#hue_0
下一个文章:HTML+CSS二级导航制作,敬请期待
*请认真填写需求信息,我们会在24小时内与您取得联系。