一、前言
本实例以“美食”为主题设计,应用html+css+js,包括图片轮翻效果、菜单导航、三级菜单、音频、留言板等,供大家参考。【关注作者|获取更多源码(2000+个Web案例源码)|优质文章】;您的支持是我创作的动力!看到这里就【点赞收藏博文】,Web开发、课程设计、毕业设计有兴趣的联系我交流分享,3Q!
2000+案例推荐,主题涵盖30+种类型:
二、网页文件
三、网页效果
以下为网页正文(节选示例):
四、代码展示
1.HTML
代码如下(节选示例):
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="">
<meta name="description" content="17素材">
<meta name="author" content="17素材">
<link href="css/css.css" rel="stylesheet">
<!--[if lt IE 9]>
<link href="css/ie.css" rel="stylesheet" type="text/css" >
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<![endif]-->
<!--[if lte IE 6]><meta http-equiv="refresh" content="0;url=IE6/IE6.html"><![endif]-->
<link href="favicon.ico" rel="SHORTCUT ICON">
<title>17素材</title>
</head>
<body>
<div class="index">
<div class="bgbox" style="background:url(images/indexbg.jpg) no-repeat top center;">
<div class="wrap pr tc">
<div class="side-nav">
<p class="logo indent">logo</p>
<ul class="navbar mt36 tc">
<li><a href="about.html"><em></em><span>餐厅介绍</span><i></i></a></li>
<li><a href="food.html"><em></em><span>我们的菜单</span><i></i></a></li>
<li><a href="Events.html"><em></em><span>活动预告</span><i></i></a></li>
<li><a href="Book.html"><em></em><span>预定中心</span><i></i></a></li>
<li><a href="news.html"><em></em><span>新闻资讯</span><i></i></a></li>
<li><a href="Wedding.html"><em></em><span>婚宴展示</span><i></i></a></li>
<li><a href="profile.html"><em></em><span>17素材在中国</span><i></i></a></li>
<li><a href="contact.html"><em></em><span>联系我们</span><i></i></a></li>
</ul>
</div>
<div class="y101"><img src="images/img1.png"></div>
<div class="menuwrap">
<div class="bd clearfix">
<a href="#">装修<i class="Arial">Decorate</i></a>
<a href="#">美食<i class="Arial">Food</i></a>
<a href="#" class="bd0">舞蹈<i class="Arial">Dance</i></a>
</div>
</div>
</div>
</div>
<div class="indexNews">
<a href="javascript:;" class="btn-slide-open indent">最新资讯展开</a>
<a href="javascript:;" class="btn-slide-close indent">最新资讯关闭</a>
<div class="wrap clearfix">
<div class="item">
<h1>新店开张</h1>
<dl>
<dt class="img"><img src="upload/img1.jpg"></dt>
<dd>
<p class="title"><a href="newshow.html">17素材餐厅西溪天堂店正式开业</a></p>
17素材餐厅西溪店,在天目山路与紫金花路交叉口,联合大厦B座二楼,这里也是17素材餐厅总部所在地。
2013年8月,在褥褥们的认同下
</dd>
</dl>
</div>
<div class="item">
<h1>企业快报</h1>
<dl>
<dt class="img"><img src="upload/img2.jpg"></dt>
<dd>
<p class="title"><a href="newshow.html">17素材餐厅西溪天堂店正式开业</a></p>
17素材餐厅西溪店,在天目山路与紫金花路交叉口,联合大厦B座二楼,这里也是17素材餐厅总部所在地。
2013年8月,在褥褥们的认同下
</dd>
</dl>
</div>
<div class="item bd0">
<h1>最新资讯</h1>
<ul class="in-news-list f12">
<li><a href="newshow.html">17素材餐厅携手新品牌布局省外 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">贺新年,运动会演绎全新时尚菜单。 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">17素材餐厅上海店、宁波店即将开 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">17素材餐厅指福门抢票活动开始啦! <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">《I.life》之第二乐章特别优惠。 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">17素材餐厅城站店、复兴店订婚宴套 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">17素材餐厅指福门吃扒菜,看爽动 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">17素材餐厅南宁万象城店9月1日盛 <sapn class="time">2014.06.21</span></a></li>
<li><a href="newshow.html">15年的总结,17素材餐厅旗舰店<sapn class="time">2014.06.21</span></a></li>
</ul>
</div>
</div>
</div>
<div class="indexfoot tc">Copyright © 2015 www.1001.com All Rights Reserved 版权所有·17素材餐厅 技术支持:<a href="http://www.17sucai.com/" target="_blank">17素材</a></div>
</div>
</body>
<script src="js/jquery.js"></script>
<script src="js/Action.js"></script>
</html>
......
2.CSS
代码如下(节选示例):
@import url(public.css);
.ico{ background:url(../images/ico.png) no-repeat; display:inline-block;}
.bgbox{ width:100%; height:1000px; overflow:hidden; }
.index{ height:1050px; overflow:hidden; position:relative;}
.side-nav{ width:160px; padding:35px 0 27px; background:url(../images/blk70.png); border-bottom-left-radius:5px; -moz-border-bottom-left-radius:5px; -ms-border-bottom-left-radius:5px; -o-border-bottom-left-radius:5px; -webkit-border-bottom-left-radius:5px; border-bottom-right-radius:5px; -moz-border-bottom-right-radius:5px; -ms-border-bottom-right-radius:5px; -o-border-bottom-right-radius:5px; -webkit-border-bottom-right-radius:5px; position:absolute; left:-80px; top:0;}
.side-nav .logo{ display:block; width:128px; height:165px; background:url(../images/logo.png) no-repeat center; margin:0 auto;}
/*首页导航*/
.navbar li{ height:23px; line-height:23px; line-height:23px; padding:7px 0;}
.navbar li em,.navbar li i,.navbar li span{ display:inline-block; height:23px; width:14px; line-height:23px; vertical-align:middle;}
.navbar li:hover em{ background:url(../images/l.png) no-repeat right center;}
.navbar li:hover i{ background:url(../images/r.png) no-repeat left center;}
.navbar li span{width:auto; padding:0 5px; }
.navbar li:hover span{ background:#fdd100;}
.navbar li a span{ color:#FFF;}
.navbar li:hover a span{ color:#252525}
.y101{ padding-top:130px;}
.menuwrap{ margin:156px auto 0; width:311px; height:64px; padding:3px; border-radius:3px; -moz-border-radius:3px; -ms-border-radius:3px; -o-border-radius:3px; -webkit-border-radius:3px; background:#FFF; overflow:hidden; }
.menuwrap .bd{ width:309px; height:62px; border:1px solid #dfdfdf; border-radius:3px; -moz-border-radius:3px; -ms-border-radius:3px; -o-border-radius:3px; -webkit-border-radius:3px; }
.menuwrap a{ display:block; float:left; width:102px; height:46px; padding:14px 0 0; border-right:1px dotted #dfdfdf; text-decoration:none; font-size:20px;}
.menuwrap a i{ display:block; font-size:12px; height:14px; line-height:14px;}
.menuwrap a:hover{ color:#1b9108; }
.indexfoot{ background:#1c1c1c; padding:13px 0; color:#666;}
.indexfoot a{ color:#666}
.foot{ padding:13px 0; color:#fff; text-align:center;}
.foot a{ color:#fff}
.indexNews{ width:100%; height:490px; background: #fff; position: absolute; bottom:-500px; left: 0; z-index: 999;}
.indexNews .btn-slide-open{ display:block; width:56px; height:50px; background:url(../images/btn-slide-open.png) no-repeat center; position: absolute; top: -148px; left: 50%; margin-left: -28px; -webkit-transition: all 0.18s ease-out; -moz-transition: all 0.18s ease-out; -ms-transition: all 0.18s ease-out; -o-transition: all 0.18s ease-out; transition: all 0.18s ease-out;}
.indexNews .btn-slide-open:hover{ top:-153px;}
.indexNews .btn-slide-close{ display:block; width:30px; height:50px; background:url(../images/btn-slide-close.png) no-repeat center; position: absolute; top: 0; left: 50%; margin-left: -15px;}
.indexNews .item{ width:397px; height: 450px; float: left; border-right: 1px solid #f2f2f2; padding-top:40px}
.indexNews .item:hover{ background:#f2f2f2;}
.indexNews .item dl,.indexNews .in-news-list{ width:290px; margin:0 auto}
.indexNews .item h1{ display:block; height:63px; line-height:63px; font-size:14px; text-align:center;}
.indexNews .item dt{ height:170px; text-align:center; vertical-align:middle;}
.indexNews .item dd{ padding-top:15px; color:#666; font-size:12px;}
.indexNews .item .title{ padding:9px 0; font-weight:bold; font-size:14px;}
.indexNews .in-news-list li{ line-height:34px; height:34px;}
.indexNews .in-news-list a .time{ color:#ccc;}
.top{ padding-top:30px;}
.header{ height:50px; background:url(../images/blk70.png);}
.header .logo{ display:block; width:134px; height:134px; position:absolute; left:0; top:-20px; }
.header .logo em{ display:block; height:20px; width:100%; background:url(../images/l-top.png) no-repeat center;}
.header .logo i{ display:block; height:64px; width:100%; background:url(../images/l-bottom.png) no-repeat center bottom; padding-top:50px;}
.header .logo span{ display:block; width:100%; height:100%; background:url(../images/logo2.png) no-repeat center; position:absolute; left:0; top:0;}
.nav{ height:50px; width:816px;}
.nav>li{ height:50px; line-height:50px; position:relative; float:left; }
.nav>li>a{ display:block; padding:0 20px; color:#FFF; font-size:13px;}
.nav>li:hover>a,.nav>li.current>a{ background:#fdd100; color:#FFF; text-decoration:none;}
.nav>li .slide-nav{ display:none;}
.nav>li:hover .slide-nav{ display:block; position:absolute; top:100%; min-width:100%; line-height:30px; text-align:center; background:url(../images/blk70.png); padding:5px 0 10px;}
.nav>li .slide-nav>li{ height:30px; line-height:30px;}
.nav>li .slide-nav>li a{ font-size:13px; color:#FFF;}
.nav>li .slide-nav>li a:hover{ color:#fdd100;}
/*内页*/
.container{ width:100%; min-width: 1120px; /*min-height:1320px; */ background-position:center top; background-repeat:no-repeat; background-size: cover; margin: 0 auto; position: relative; zoom: 1;}
.w-title{ padding-top:170px;}
.w-title .title{ font-size:36px; height:36px; line-height:36px; color:#FFF; font-family: "David",Arial, Helvetica, sans-serif;}
.w-title .name{ height:1px; width:869px; margin:50px auto 60px; background:url(../images/name.png); position:relative;}
.w-title .name span{ display:inline-block; position:relative; height:30px; line-height:30px; padding:0 30px; top:-15px; background:#f4eddd; font-size:16px; color:#504001;}
.w-title .name em{ display:block; width: 0; height: 0; border-top: 6px solid transparent; border-right: 6px solid #f4eddd; border-bottom: 6px solid transparent; position:absolute; left:-6px; top:50%; margin-top:-6px;}
.w-title .name i{ display:block; width: 0; height: 0; border-top: 6px solid transparent; border-left: 6px solid #f4eddd; border-bottom: 6px solid transparent; position:absolute; right:-6px; top:50%; margin-top:-6px; }
.conwrap{ width:880px; margin:0 auto; min-height:646px;}
.conwrap .con-top{ height:60px; padding-top:10px; line-height:60px; background:url(../images/con-top.png) no-repeat center; font-size:24px; text-align:center; color:#333;}
.conwrap .con-top img{ display:inline-block; margin-left:10px; vertical-align:middle;}
.conwrap .con-top.bort{ border-bottom:1px solid #828282;}
.conwrap .con-bd{ background:url(../images/con-bd.png) repeat-y;}
.conwrap .con-bd .txt{ padding:15px 35px;}
.conwrap .con-bottom{ height:30px;background:url(../images/con-bottom.png) no-repeat center;}
.link-prev,.link-next{ display:block; width:60px; height:119px; background:url(../images/link-btn.png) no-repeat 0 0; position:fixed; top:50%; margin-top:-59px; left:0;}
.link-next{ background-position:-63px 0; left:auto; right:0;}
.newslist li{ padding:7px 0; height:24px; font-size:14px;}
.newslist li .time{ display:inline-block; width:72px; font-style:italic; color:#999; font-size:12px;}
.back{ display:block; width:69px; height:32px; background:url(../images/back.png) no-repeat center; margin:20px auto 0;}
.control-group{ margin:7px 0; float:left; width:348px; height:38px; line-height:38px; padding:0 15px; border:1px solid #ececec; border-radius:3px; -moz-border-radius:3px; -ms-border-radius:3px; -o-border-radius:3px; -webkit-border-radius:3px; background:#FFF; overflow:hidden;}
.control-group .tt{ display:inline-block; width:38px; height:14px; line-height:14px; font-size:14px; float:left; border-right:1px solid #ccc; margin-top:12px;}
.control-group label{ display:inline-block; width:300px; height:100%; float:right; position:relative}
.control-group label input{ border:0; height:100%; width:100%; outline:none;}
.control-group label .myfont{ display:block; width:15px; height:100%; line-height:38px; text-align:center; position:absolute; right:0; top:0; font-size:18px; color:#a9a9a9;}
.btn-book{ width:91px; height:32px; line-height:32px; text-indent:999px; overflow:hidden; background:url(../images/book.png) no-repeat center;}
.menu-wrap{ padding:5px; background:#f4eddd; border-radius:5px; -moz-border-radius:5px; -ms-border-radius:5px; -o-border-radius:5px; -webkit-border-radius:5px; width:1180px;}
.menu-wrap .menubox{ min-height:400px; border:1px solid #828282; border-radius:5px; -moz-border-radius:5px; -ms-border-radius:5px; -o-border-radius:5px; -webkit-border-radius:5px; overflow:hidden; padding:22px 21px;}
.menubox .price{ color:#780a06;}
.menubox dl{ float:left; width:240px; margin:22px; }
.menubox dl dt{ height:200px;}
.menubox dl dt img{ max-height:100%; max-width:100%; }
.menubox dl dd{ padding-top:10px;}
.menubox .txt{ height:48px; overflow:hidden;}
.widding-wrap{ min-width:1432px; width:1432px; height:238px; margin:125px auto 255px;}
.widding-wrap .item{ float:left; height:228px; width:308px; padding:5px; border-radius:5px; -moz-border-radius:5px; -ms-border-radius:5px; -o-border-radius:5px; -webkit-border-radius:5px; margin:0 20px; background:#FFF; overflow:hidden;}
.widding-wrap .item .img{ height:162px; border-top-left-radius:5px; -moz-border-top-left-radius:5px; -ms-border-top-left-radius:5px; -o-border-top-left-radius:5px; -webkit-border-top-left-radius:5px; border-top-right-radius:5px; -moz-border-top-right-radius:5px; -ms-border-top-right-radius:5px; -o-border-top-right-radius:5px; -webkit-border-top-right-radius:5px;}
.widding-wrap .item .txt{ padding:10px 10px 0; position:relative;}
.widding-wrap .item .time{ font-size:12px;}
.widding-wrap .item .more{ display:block; width:21px; height:21px; text-align: center; line-height:21px; border:1px solid #949494; font-size:26px; font-family:"宋体"; position:absolute; right:15px; top:25px; color:#949494;-moz-border-radius:5px; -ms-border-radius:5px; -o-border-radius:5px; -webkit-border-radius:5px; text-decoration:none;}
.slick-prev,.slick-next{ display:none !important}
.slide-show { width:880px;}
.slide-show .img{ height:300px;}
.slide-show .slick-dots{ bottom:20px;}
/*========== page ==========*/
.page{height:30px; padding:30px 0 20px;}
.page span,.page a{ display:inline-block; border:1px solid #e4e4e4; height:28px; line-height:28px; padding:0 10px;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px; margin:0 4px; text-decoration:none; background:#FFF;}
.page span,.page a.active,.page a:hover{ color:#FFF; background:#f9ac43; border-color:#f9ac43;}
.page a em{ display:inline-block; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent;}
.page a.prev em{border-right: 8px solid #999; margin-right:5px;}
.page a.next em{border-left: 8px solid #999; margin-left:5px;}
.page a.prev:hover em{ border-right-color:#FFF;}
.page a.next:hover em{ border-left-color:#FFF;}
......
3.JS
代码如下(节选示例):
$(window).load(function(){
//首页最新资讯显示
$(".btn-slide-open").click(function(){
$(this).css({"height":"0","top":"70px"}).parents(".indexNews").animate({
bottom:"0",
})
})
$(".btn-slide-close").click(function(){
$(this).parents(".indexNews").animate({
bottom:"-510px"
}).find(".btn-slide-open").animate({"height":"56px","top":"-148px"})
})
//导航
nav();
$(".control-group:odd").addClass("fr");
//dot
var w=$(".slick-dots").width()*0.5;
$(".slick-dots").css("margin-left",-w);
})
//导航高亮
function nav(){
var _nav = $("body").attr("cur");
if (_nav != "" && (!isNaN(_nav))) {
$(".nav>li").eq(_nav).addClass("current");
}
}
//判断路径,给左边菜单加样式
function GetRequest() {
var str=location.pathname;
a=str.substr(str.lastIndexOf("/")+1);
$(".sidebar a").each(function() {
var a_h=$(this).attr("href");
if(a==a_h){
$(this).parents("li").addClass("active");
}
});
}
//产品页面条件筛选为选中的条件加样式
function initclass() {
var id = getQueryStringByName("id");
if (!isNaN(id)) {
$(".Grouplist .job").eq(id).find(".job-bd").show().siblings(".job-hd").addClass("active");/*
var url = "Group.html?id=" + id;
$(".nav-pills li a[href='" + url + "']").parents("li").addClass("active").siblings("li").removeClass("active");*/
}
}
//根据QueryString参数名称获取值
function getQueryStringByName(name) {
var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
if (result == null || result.length < 1) {
return "";
}
return result[1];
}
//--输入框内提示-------------
function input(a){
$(a).each(function(){
var thisVal=$(this).val();
if(thisVal!=""){
$(this).siblings("span").hide();
}
else{
$(this).siblings("span").show();
}
$(this).focus(function(){
$(this).siblings("span").hide();
}).blur(function(){
var val=$(this).val();
if(val!=""){
$(this).siblings("span").hide();
}
else{
$(this).siblings("span").show();
}
});
});
}
//字数限制
function words_deal(){var a=$("#TextArea1").val().length;if(a>500){var b=$("#TextArea1").val().substr(0,500);$("#TextArea1").val(b),alert("\u8d85\u8fc7\u5b57\u6570\u9650\u5236\uff0c\u591a\u51fa\u7684\u5b57\u5c06\u88ab\u622a\u65ad\uff01")}else $("#textCount").text(500-$("#TextArea1").val().length)}
......
五、总结
1. 页面分为页头、菜单导航栏(最好可下拉)、中间内容板块、页脚四大部分;
2. 所有页面相互超链接,可到二级或三级页面,有5-10个页面组成;
3. 页面样式风格统一布局显示正常,不错乱,使用HTML5+CSS3+JS技术;
4. 菜单美观、醒目,二级菜单可正常弹出与跳转;
5. 要有JS特效,如定时切换和手动切换图片新闻;
6. 页面中有多媒体元素,如gif、视频、音乐,表单技术的使用;
7. 页面清爽、美观、大方,不雷同;
8. 网站前端程序不仅要能够把用户要求的内容呈现,还要满足布局良好、界面美观、配色优雅、表现形式多样等要求。
标签:web,top,36,height,width,radius,5px,js,border From: https://blog.csdn.net/A240307/article/details/137041423