499.大学生HTML期末大作业 —【西北大学新闻专题网页(7页)】 Web前端网页制作 html+css+js

目录

一、网页简介

二、网页文件

三、网页效果

四、代码展示

1.html

2.CSS

五、总结

1.简洁实用

2.使用方便

3.整体性好

4.形象突出

5.交互式强


欢迎来到我的优快云主页!您的支持是我创作的动力!Web前端网页制作、网页完整代码、大学生期末大作业案例模板完整代码、技术交流等,有兴趣的联系我交流学习!更多优质博客文章、网页模板点击以下链接查阅:

仙女网页设计-优快云博客

 5000+网页案例完整代码,主题涵盖30+种类型:


一、网页简介

本实例应用html+css,div+css布局,适用于大学生网页课程作业设计。本网页支持如Dreamweaver、HBuilder、Text 、Vscode 等任意html编辑软件进行编辑修改;支持包括IE、Firefox、Chrome、Safari主流浏览器浏览。


二、网页文件

本网页实例共包含7个页面:


三、网页效果

以下是本篇文章正文内容,下面案例仅供参考(节选示例):


四、代码展示

1.html

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>首页</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="web">
<div class="top"><div class="logo"><img src="img/logo.png"></div></div>
<div class="nav">
<ul>
<li><a class="hot" href="index.html">网站首页</a></li>
<li><a href="index01.html">西北要闻</a></li>
<li><a href="index02.html">校园新闻</a></li>
<li class="mar0"><a href="index03.html">校园文化</a></li>
</ul>
</div>
<div class="box1">
<div class="left">
<div class="box" id="box">
    <div class="inner">
        <!--轮播图-->
        <ul>
            <li><a href="#"><img src="img/img09.jpg" alt=""></a></li>
             <li><a href="#"><img src="img/img10.jpg" alt=""></a></li>
              <li><a href="#"><img src="img/img11.jpg" alt=""></a></li>
     
 
        </ul>
 
        <ol class="bar">
 
        </ol>
     
 
    </div>
</div>

<script>
    /**
     *
     * @param id  传入元素的id
     * @returns {HTMLElement | null}  返回标签对象,方便获取元素
     */
    function my$(id) {
        return document.getElementById(id);
    }
 
    //获取各元素,方便操作
    var box=my$("box");
    var inner=box.children[0];
    var ulObj=inner.children[0];
    var list=ulObj.children;
    var olObj=inner.children[1];
    var arr=my$("arr");
    var imgWidth=inner.offsetWidth;
    var right=my$("right");
    var pic=0;
    //根据li个数,创建小按钮
    for(var i=0;i<list.length;i++){
        var liObj=document.createElement("li");
 
        olObj.appendChild(liObj);
        liObj.innerText=(i+1);
        liObj.setAttribute("index",i);
 
        //为按钮注册mouseover事件
        liObj.οnmοuseοver=function () {
            //先清除所有按钮的样式
 
            for (var j=0;j<olObj.children.length;j++){
                olObj.children[j].removeAttribute("class");
            }
            this.className="current";
            pic=this.getAttribute("index");
            animate(ulObj,-pic*imgWidth);
        }
 
    }
 
 
    //设置ol中第一个li有背景颜色
    olObj.children[0].className = "current";
    //克隆一个ul中第一个li,加入到ul中的最后=====克隆
    ulObj.appendChild(ulObj.children[0].cloneNode(true));
 
    var timeId=setInterval(onmouseclickHandle,2000);
    //左右焦点实现点击切换图片功能
    box.οnmοuseοver=function () {
        arr.style.display="block";
        clearInterval(timeId);
    };
    box.οnmοuseοut=function () {
        arr.style.display="none";
        timeId=setInterval(onmouseclickHandle,2000);
    };
 
    right.οnclick=onmouseclickHandle;
    function onmouseclickHandle() {
        //如果pic的值是5,恰巧是ul中li的个数-1的值,此时页面显示第六个图片,而用户会认为这是第一个图,
        //所以,如果用户再次点击按钮,用户应该看到第二个图片
        if (pic == list.length - 1) {
            //如何从第6个图,跳转到第一个图
            pic = 0;//先设置pic=0
            ulObj.style.left = 0 + "px";//把ul的位置还原成开始的默认位置
        }
        pic++;//立刻设置pic加1,那么此时用户就会看到第二个图片了
        animate(ulObj, -pic * imgWidth);//pic从0的值加1之后,pic的值是1,然后ul移动出去一个图片
        //如果pic==5说明,此时显示第6个图(内容是第一张图片),第一个小按钮有颜色,
        if (pic == list.length - 1) {
            //第五个按钮颜色干掉
            olObj.children[olObj.children.length - 1].className = "";
            //第一个按钮颜色设置上
            olObj.children[0].className = "current";
        } else {
            //干掉所有的小按钮的背景颜色
            for (var i = 0; i < olObj.children.length; i++) {
                olObj.children[i].removeAttribute("class");
            }
            olObj.children[pic].className = "current";
        }
    }
    left.οnclick=function () {
        if (pic==0){
            pic=list.length-1;
            ulObj.style.left=-pic*imgWidth+"px";
        }
        pic--;
        animate(ulObj,-pic*imgWidth);
        for (var i = 0; i < olObj.children.length; i++) {
            olObj.children[i].removeAttribute("class");
        }
        //当前的pic索引对应的按钮设置颜色
        olObj.children[pic].className = "current";
    };
 
    //设置任意的一个元素,移动到指定的目标位置
    function animate(element, target) {
        clearInterval(element.timeId);
        //定时器的id值存储到对象的一个属性中
        element.timeId = setInterval(function () {
            //获取元素的当前的位置,数字类型
            var current = element.offsetLeft;
            //每次移动的距离
            var step = 10;
            step = current < target ? step : -step;
            //当前移动到位置
            current += step;
            if (Math.abs(current - target) > Math.abs(step)) {
                element.style.left = current + "px";
            } else {
                //清理定时器
                clearInterval(element.timeId);
                //直接到达目标
                element.style.left = target + "px";
            }
        }, 10);
    }
</script>
<ul>
<li><a href="index0101.html">城环学院学生参加中国高校地理科学...<span>19-11-12</span></a></li>
<li><a href="index0102.html">我校青年创客受邀参加"2019年...<span>19-11-12</span></a></li>
<li><a href="index0103.html">数学学院举办青年教师多媒体...<span>19-11-12</span></a></li>
<li><a href="index0101.html">城环学院学生参加中国高校地理科学...<span>19-11-12</span></a></li>
<li><a href="index0102.html">我校青年创客受邀参加"2019年...<span>19-11-12</span></a></li>
<li><a href="index0103.html">数学学院举办青年教师多媒体...<span>19-11-12</span></a></li>
<li><a href="index0101.html">城环学院学生参加中国高校地理科学...<span>19-11-12</span></a></li>
<li><a href="index0102.html">我校青年创客受邀参加"2019年...<span>19-11-12</span></a></li>
<li><a href="index0103.html">数学学院举办青年教师多媒体...<span>19-11-12</span></a></li>
</ul>
</div>
<div class="cent">
<div class="tit"><a href="index02.html"><h1>校园新闻</h1></a></div>
<div class="bx1">
<a href="index0101.html">
<h1>城环学院学生参加中国高校地理科学展示</h1>
<p>日前,"新蚁族杯"第五届高校地理科学展示大赛总决赛在南京大学举行。由我校城市与环境学院何毅、张玉柱老师指导,2017级自然地理与</p>
</a>
</div>
<div class="bx2">
<a href="index0102.html">
<h2>我校青年创客受邀参加"2019年西安大学生创客节"活动 </h2>
<p>11月23日,由西安市人力资源和社会保障局、西安电子科技大学主办,西安市财政局、西安交通大学、西北工业大学及我校等高校联合协办的"2019年西安大学生创客节"活动在西安电子科技大学长安校区举行。本次创客节活动主要包括开幕式、创客论坛、就业创业政策宣讲、创新创业项目展示、智能机器人表演等七项内容。</p>
</a>
<a href="index0103.html">
<h2>数学学院举办青年教师多媒体课件设计竞赛 </h2>
<p>11月27日,数学学院举行2019年青年教师多媒体课件设计竞赛。校党委常委、副校长王尧宇应邀与数学学院全体教职工参加了此次活动。活动旨在鼓励青年教师采取多元化手段教学,提高教学质量,增强与学生的沟通互动,提升课堂教学效果。本次竞赛活动共有30多位教师提交了参赛作品,经过多轮评审,共遴选优秀课件12部。刘俊荣、韩迪、孙宜民、赵婷婷、曾玲莉5位老师进行了现场课件展示。</p>
</a>
</div>

...

2.CSS

代码如下(节选示例):

body{ margin:0 auto; font-size:12px; font-family: "微软雅黑",arial; line-height:22px; color:#141515; }
div,p,input,ul,li,p,h1,h2,h3,h4{ height:auto; margin:0;; padding:0; vertical-align:middle ;}
li{ list-style:none;}
a{ text-decoration:none; color:#141515;}
a:hover{ color:#1575be;}
.ul{ list-style:none;}
img{ border:0; margin:0; padding:0;}
.web{width:1170px; height:auto; overflow:hidden; margin:0 auto; background:#FFF;}
.top{ height:123px; padding-top:41px; background:url(../img/bg1.jpg) no-repeat;}
.logo{ width:531px; height:83px; margin-left:41px; }
.nav{ width:1170px; height:50px; background:#1575be; margin-bottom:15px;}
.nav ul{ padding:0px; margin:0px;}
.nav ul li{ width:200px; height:50px; line-height:50px; text-align:center; float:left; margin-right:100px;}
.nav ul li a{ color:#f7fafc; display:block;width:200px; height:50px; font-size:16px;}
.nav ul li a:hover{ background:#0c558c;}
.mar0{ margin-right:0px !important;}
.hot{background:#0c558c !important;;}
.box1{ height:530px; margin-bottom:15px;}
.left{ width:339px; height:530px; float:left;  margin-right:15px; padding-left:5px;}
 .box {
    width: 338px;
    height: 225px;
    
        }
        .inner{
    width: 338px;
    height: 225px;
    position: relative;
    overflow: hidden;
        }
        .inner img{
       width: 338px;
    height: 225px;
            vertical-align: top
        }
        .inner ul {
            width: 1000%;
            position: absolute;
            list-style: none;
            left:0;
            top: 0;
        margin:0px;
        padding:0px;
        }
        .inner li{
            float: left;
 
        }
 
        ol {
    position: absolute;
    height: 20px;
    right: 20px;
    bottom: 12px;
    text-align: center;
    padding: 5px;
        }
        ol li{
    display: block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    background-color: #fff;
    margin: 5px;
    cursor: pointer; 
        }
        ol .current{
            background-color: red;
        }
        
.left ul{ padding:0px; margin:0px;}
.left ul li{ height:30px; line-height:30px;}
.left ul li a{ font-size:14px;}
.left ul li span{ float:right; color:#8e8f8f;}
.cent{ width:465px; height:530px; float:left; margin-right:15px;}
.tit{ height:38px; background:#f8f8f8;}
.tit h1{ font-size:16px; font-weight:normal; padding-left:10px; width:80px; line-height:35px; border-top:#1575be 2px solid; }
.cent .bx1{ height:110px; border-bottom:#CCC 1px dashed;}
.cent .bx1 h1{ padding-top:10px; height:35px; line-height:35px; font-size:18px; text-align:center;font-weight:normal;}
.cent .bx2{ height:379px;}
.cent .bx2 h2{ color:#1575be; font-weight:normal; line-height:30px; font-size:16px;}
.cent  p{ line-height:25px; font-size:14px; text-indent:2em;}
.right{ width:311px; float:left; height:510px; background:#f8f8f8; padding:0px 10px; }
.right p{ line-height:25px; font-size:14px; text-indent:2em;}
.tit2{ height:38px; }
.tit2 h1{ font-size:16px; font-weight:normal; padding-left:10px; width:331px; line-height:35px; border-top:#1575be 2px solid; }
.box2{ height:560px; }
.box2 ul{ padding:0px;}
.box2 ul li{ width:269px; height:245px; float:left; margin:0px 11px;}
.box2 ul li img{ margin:10px;}
.box2 ul li p{ height:35px; line-height:35px; font-size:14px; text-align:center;}
.foot{ width:1170px; height:90px; line-height:80px; background:#eeeeee; text-align:center; font-size:14px; color:#1c1c1b;}

.yw{ width:1170px; min-height:750px; height:auto; overflow:hidden; padding-bottom:50px;}
.yleft{ width:351px; height:330px; float:left; margin-right:25px; border-top:#1575be 3px solid;}
.title{ height: 35px;
line-height: 35px;
font-size: 18px;
padding-left: 30px;
margin-bottom: 10px;
background: url(../img/bg2.jpg) no-repeat 0px 10px;}
.yleft img{ float:left; margin-bottom:10px; width:167px;}
.yleft ul{ padding:0px;}
.yleft ul li{width:167px; float:left;}
.mar10{ margin-right:10px;}
.yright{ width:790px; height:auto; overflow:hidden;float:left; }
.rtitle{ height:40px; border-bottom:#666 1px solid; line-height:35px; padding-left:20px; background:url(../img/bg3.jpg) no-repeat 0px 5px; font-size:18px; margin-bottom:10px;}
.yright ul{ padding:0px;}
.yright ul li{ line-height:40px; height:40px; border-bottom:#999 1px dashed;}
.yright ul li a{ font-size:16px;}
.yright ul li span{ float:right;}
.ynews{ width:790px; height:auto; overflow:hidden;float:left; height:930px;}
.ynews ul{padding:0px;}
.ynews ul li{ height:120px; border-bottom:#999 1px dashed; margin-bottom:20px;}
.ynews ul li img{ width:157px; height:98px; float:left; margin-right:15px;}
.ynews ul li h1{ height:30px; line-height:30px; font-weight:normal; font-size:16px;}
.ynews ul li p{ line-height:20px; font-size:14px; margin-bottom:10px; color:#666}
.ynews ul li h2{ font-weight:normal; font-size:14px;color:#666}
 

...


五、总结

设计一个样式美观又人性化的网页,除了具备扎实的专业知识,还需具备美学和人机工程学等相关知识,优秀的网页应具备以下几个特点:

1.简洁实用

尽量以最高效率的方式将用户所要想得到的信息传送给他就是最好的,要去掉所有的冗余的东西;

2.使用方便

要满足使用者的要求,网页适合使用,显示出其功能美;

3.整体性好

围绕一个统一的目标设计,强调整体的功能性; 

4.形象突出

尽量符合网页美的标准,能够使网站的形象得到最大限度的提升,追求雅俗共赏。页面用色协调,布局符合形式美的要求:布局有条理,充分利用美的形式,使网页富有可欣赏性,提高档次。

5.交互式强

发挥网络的优势,想方设法使每个使用者都参与到其中来。


更多优质博客文章、完整代码案例模板,点击以下链接查阅:

仙女网页设计-优快云博客

Web前端网页制作、大学生期末大作业、课程设计、毕业设计、完整代码案例模板、Web前端网页定制、教学课程、学习资料等,有需要的添加以下微信交流👇🏻👇🏻👇🏻


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值