目录
前言
梅花鹿保护动物主题网页设计实例,应用html+css+js: Div、导航栏、图片轮翻效果、音频、留言表单等。适用于大学生网页课程作业设计,供大家参考。
一、网页概述
网页布局为“同字型”的布局,即最上面是网站的标题以及横幅广告条,接下来就是网站的主要内容,左右分列一些两小条内容,中间是主要部分,与左右一起罗列到底。
支持如Dreamweaver、HBuilder、Text 、Vscode 等任意html编辑软件进行编辑修改;支持包括IE、Firefox、Chrome、Safari主流浏览器浏览。
二、网页文件
本网页实例共包含8个页面:
三、网页效果
以下是本篇文章正文内容,下面案例仅供参考(节选示例):
四、代码展示
1.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/js.js"></script>
<title>梅花鹿</title>
</head>
<body>
<audio src="images/MP3.mp3" controls="controls" autoplay> </audio>
<div class="wrapin"> <a href="#" class="logo"><img src="images/logo.png"/></a>
<!--头部-->
<header>
<ul class="nav clearfix">
<li><a href="index.html">首页</a></li>
<li><a href="xixing.html">习性介绍</a></li>
<li><a href="juqing.html">历史文化</a></li>
<li><a href="tupian.html">图片鉴赏</a></li>
<li><a href="lianxi.html">联系我们</a></li>
</ul>
</header>
<div class="banner_box ">
<div class="box-1">
<ul>
<li> <img src="images/banner_01.jpg"></img> </li>
<li> <img src="images/banner_02.jpg"></img> </li>
<li> <img src="images/banner_03.jpg"></img> </li>
<li> <img src="images/banner_04.jpg"></img> </li>
</ul>
</div>
<div class="box-2">
<ul>
</ul>
</div>
<div class="box-3"> <span class="prev"> < </span> <span class="next"> > </span> </div>
</div>
<!--内容-->
<div class="con">
<div class="top clearfix">
<div class="text">
<h2>梅花鹿 <span>(鹿科哺乳动物)</span></h2>
<br>
<P>梅花鹿(学名:Cervus nippon)是一种中小型鹿,体长125至145厘米,尾长12至13厘米,肩高70至95厘米,体重70至100千克。毛色夏季为栗红色,有许多白斑,状似梅花;冬季为烟褐色,白斑不显著。颈部有鬣毛。雄性角长达30至66厘米。 <br>
<br>
梅花鹿群居性不强,雄鹿往往是独自生活,活动时间集中在早晨和黄昏,生活区域随着季节的变化而改变,春季多在半阴坡,夏秋季迁到阴坡的林缘地带,冬季则喜欢在温暖的阳坡,主要以草、水果、草本植物、树芽、树、农作物为食。种群主要分布在俄罗斯东部、日本和中国。是中国国家一级保护动物,列入世界自然保护联盟(IUCN)2015年《濒危物种红色名录》ver 3.1——低危(LC)</P>
</div>
<div class="pic"> <img src="images/xiaolu.png"/> </div>
</div>
<div class="tupian">
<div class="title">
<h2>图片鉴赏</h2>
</div>
<ul class="clearfix">
<li><img src="images/img_06.jpg"/></li>
<li><img src="images/img_04.jpg"/></li>
<li><img src="images/img_05.jpg"/></li>
</ul>
</div>
</div>
<!--底部-->
<footer>
<p>梅花鹿</p>
</footer>
</div>
</body>
</html>
...
2.CSS
代码如下(节选示例):
/*通用类*/
* {
margin: 0;
padding: 0;
}
body {
margin: 0 auto;
font-size: 14px;
background: url(../images/bg_01.jpg) no-repeat fixed;
background-size: cover;
color: #333;
position: relative;
}
img {
border: none;
}
a {
cursor: pointer;
color: #333;
text-decoration: none;
outline: none;
}
ul {
list-style-type: none;
}
em {
font-style: normal;
}
.lt {
float: left;
}
.rt {
float: right;
}
div.clear {
font: 0px Arial;
line-height: 0;
height: 0;
overflow: hidden;
clear: both;
}
.clearfix::after {
content: "";
display: block;
clear: both;
}
/*wrapin 主体容器宽度*/
.wrapin {
width: 1000px;
margin-left: auto;
margin-right: auto;
}
audio{ display: none;}
.logo {
display: block;
width: 260px;
margin: 0 auto;
}
.logo img {
width: 100%;
}
header {
height: 50px;
background: #f7be5c;
}
.nav li {
line-height: 50px;
float: left;
width: 20%;
text-align: center;
font-size: 16px;
}
.nav li a {
color: #fff;
}
.banner {
display: block;
}
.banner img {
width: 100%;
display: block;
}
.banner_box {
width: 100%;
height: 560px;
overflow: hidden;
position: relative;
}
.box-1 ul {
}
.box-1 ul li {
width: 100;
height: 560px;
position: relative;
overflow: hidden;
}
.box-1 ul li img {
display: block;
width: 100%;
height: 100%;
}
.box-1 ul li h2 {
position: absolute;
left: 0;
bottom: 0;
height: 40px;
width: 100%;
background: rgba(125,125,120,.4);
text-indent: 2em;
padding-right: 500px;
font-size: 15px;
line-height: 40px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-weight: normal;
color: ghostwhite
}
.box-2 {
position: absolute;
right: 10px;
bottom: 14px;
}
.box-2 ul li {
float: left;
width: 12px;
height: 12px;
overflow: hidden;
margin: 0 5px;
border-radius: 50%;
background: rgba(0,0,0,0.5);
text-indent: 100px;
cursor: pointer;
}
.box-2 ul .on {
background: rgba(255,255,255,0.6);
}
.box-3 span {
position: absolute;
color: rgba(255,255,255,0.1);
background: rgba(255,255,255,0.1);
width: 50px;
height: 80px;
top: 50%;
font-family: "宋体";
...
3.JS
代码如下(节选示例):
// JavaScript Document
window.onload = function(){
function $(param){
if(arguments[1] == true){
return document.querySelectorAll(param);
}else{
return document.querySelector(param);
}
}
var $box = $(".box");
var $box1 = $(".box-1 ul li",true);
var $box2 = $(".box-2 ul");
var $box3 = $(".box-3");
var $length = $box1.length;
var str = "";
for(var i =0;i<$length;i++){
if(i==0){
str +="<li class='on'>"+(i+1)+"</li>";
}else{
str += "<li>"+(i+1)+"</li>";
}
}
$box2.innerHTML = str;
var current = 0;
var timer;
timer = setInterval(go,4000);
function go(){
for(var j =0;j<$length;j++){
$box1[j].style.display = "none";
$box2.children[j].className = "";
}
if($length == current){
current = 0;
}
$box1[current].style.display = "block";
$box2.children[current].className = "on";
current++;
}
for(var k=0;k<$length;k++){
$box1[k].onmouseover = function(){
clearInterval(timer);
}
$box1[k].onmouseout = function(){
timer = setInterval(go,4000);
}
}
for(var p=0;p<$box3.children.length;p++){
$box3.children[p].onmouseover = function(){
clearInterval(timer);
};
$box3.children[p].onmouseout = function(){
timer = setInterval(go,4000);
}
}
for(var u =0;u<$length;u++){
$box2.children[u].index = u;
$box2.children[u].onmouseover = function(){
clearInterval(timer);
for(var j=0;j<$length;j++){
$box1[j].style.display = "none";
$box2.children[j].className = "";
}
this.className = "on";
$box1[this.index].style.display = "block";
current = this.index +1;
}
$box2.children[u].onmouseout = function(){
timer = setInterval(go,2000);
}
}
$box3.children[0].onclick = function(){
back();
}
$box3.children[1].onclick = function(){
go();
}
function back(){
for(var j =0;j<$length;j++){
$box1[j].style.display = "none";
$box2.children[j].className = "";
}
if(current == 0){
current = $length;
}
$box1[current-1].style.display = "block";
$box2.children[current-1].className = "on";
current--;
}
}
...
五、总结
一个优秀的网页应具备以下几个特点:
1.简洁实用
尽量以最高效率的方式将用户所要想得到的信息传送给他就是最好的,要去掉所有的冗余的东西;
2.使用方便
要满足使用者的要求,网页适合使用,显示出其功能美;
3.整体性好
围绕一个统一的目标设计,强调整体的功能性;
4.形象突出
尽量符合网页美的标准,能够使网站的形象得到最大限度的提升,追求雅俗共赏。页面用色协调,布局符合形式美的要求:布局有条理,充分利用美的形式,使网页富有可欣赏性,提高档次。
5.交互式强
发挥网络的优势,想方设法使每个使用者都参与到其中来。
六、更多推荐
【关注作者|获取更多源码(2000+个网页源码)|优质文章】;您的支持是我创作的动力!看到这里就【点赞收藏博文】,三连支持下吧,3Q!
Web前端网页制作、整站模板、3D炫酷效果、图片展示、文字效果、大学生毕业HTML、期末大作业模板案例等技术内容,有兴趣的联系我交流学习!
更多优质博客文章、网页模板点击以下链接查阅:仙女网页设计-CSDN博客。