当前位置: 首页 > news >正文

前端的页面代码

        根据老师教的前端页面的知识,加上我也是借鉴了老师上课所说的代码,马马虎虎的写出了页面。如下代码:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><link rel="stylesheet" href="./css/reset_css.css"><link rel="stylesheet" href="./css/data_css.css">
</head>
<body>
<div class="box"><div class="img1"><ul><li><img style="z-index: 1" src="./images/大图1.webp" alt=""></li><li><img src="./images/大图2.webp" alt=""></li><li><img src="./images/大图3.webp" alt=""></li><li><img src="./images/大图4.webp" alt=""></li></ul></div><div class="img2"><ul><li><img style="z-index: 11" src="./images/小图1.webp" alt=""></li><li><img src="./images/小图2.webp" alt=""></li><li><img src="./images/小图3.webp" alt=""></li><li><img src="./images/小图4.webp" alt=""></li></ul></div><div class="btn"><ul id="l1"><li><img style="z-index: 11" class="img1" src="./images/按钮左1.webp" alt=""></li><li><img class="img1" src="./images/按钮左2.webp" alt=""></li><li><img class="img1" src="./images/按钮左3.webp" alt=""></li><li><img class="img1" src="./images/按钮左4.webp" alt=""></li></ul><ul id="l2"><li><img style="z-index: 11" class="img2" src="./images/按钮右1.webp" alt=""></li><li><img class="img2" src="./images/按钮右2.webp" alt=""></li><li><img class="img2" src="./images/按钮右3.webp" alt=""></li><li><img class="img2" src="./images/按钮右4.webp" alt=""></li></ul></div><div class="cir"><ul><li></li><li></li><li></li><li></li></ul></div></div>
<script src="./js/date.js"></script>
</body>
</html>

        运行此代码时,还需要联合css和js代码。

        js代码如下:

var img=document.querySelectorAll(".box .img1 li img")
var img1=document.querySelectorAll(".box .img2 li img")
var cir=document.querySelectorAll(".box .cir li")
var btn=document.querySelectorAll(".box .btn .img1")
var btn1=document.querySelectorAll(".box .btn .img2")function f1(i) {for (let j=0;j<cir.length;j++){img[j].setAttribute("style", "z-index:0")img1[j].setAttribute("style", "z-index:0")btn[j].setAttribute("style", "z-index:0")btn1[j].setAttribute("style", "z-index:0")}img[i].setAttribute("style", "z-index:"+(i+1))img1[i].setAttribute("style", "z-index:"+(i+11))btn[i].setAttribute("style", "z-index:"+(i+11))btn1[i].setAttribute("style", "z-index:"+(i+11))
}for (let i=0;i<cir.length;i++){cir[i].onclick=function () {f1(i)index=i}
}var l1=document.getElementById("l1")
var l2=document.getElementById("l2")
var index=0
l2.onclick=function () {if (index == img.length-1){index=0}else{index++}f1(index)
}l1.onclick=function () {if (index == 0){index=img.length-1}else{index--}f1(index)
}

        css代码如下:

1)data文件代码

.box{width: 1800px;height: 800px;margin: 20px auto;position: relative;left: 0;top: 0;
}
.box .img1 img{width: 1800px;height: 800px;position: absolute;top: 0;left: 0;
}
.box .img2 img{width: 700px;height: 350px;position: absolute;top: 30%;left: 30%;margin-top: -50px;margin-left: 15px;
}
.box .btn .img1{width: 75px;height: 75px;position: absolute;top: 50%;left: 20%;margin-left: 80px;margin-top: -75px;
}
.box .btn .img2{width: 75px;height: 75px;position: absolute;top: 50%;right: 20%;margin-right: 80px;margin-top: -75px;
}
.box .cir ul{position: absolute;left: 50%;bottom: 25%;transform: translateX(-50px);margin-left: -10px;z-index: 50;
}
.box .cir li{width: 10px;height: 10px;background-color: forestgreen;border-radius: 50%;float: left;margin-right: 5px;border: forestgreen solid 5px;
}
.box .cir li:hover{background-color: dimgray;
}
.box .btf #img3{position: absolute;bottom: 5%;left: 30%;margin-left: 40px;margin-bottom: 5px;z-index: 50;
}
.box .btf #img4{position: absolute;bottom: 5%;left: 40%;margin-left: 20px;margin-bottom: 5px;z-index: 50;
}
.box .btf #img5{position: absolute;bottom: 5%;left: 50%;margin-left: 35px;margin-bottom: 5px;z-index: 50;
}
.box .btf #img6{position: absolute;bottom: 5%;right: 30%;margin-right: 40px;margin-bottom: 5px;z-index: 50;
}

2)reset文件代码

/* http://meyerweb.com/eric/tools/css/reset/v2.0 | 20110126License: none (public domain)
*/html, body, div, span, applet, object, iframe,
h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {display: block;
}
body {line-height: 1;
}
ol, ul {list-style: none;
}
blockquote, q {quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {content: '';content: none;
}
table {border-collapse: collapse;border-spacing: 0;
}

        结合上述前端代码,运行如下:

        在此是用老师发送原神图片练习的。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 代码随想录算法训练营:26/60
  • 通义千问Qwen-VL-Chat大模型本地训练(二)
  • Spring Boot 实现统一异常处理:构建健壮的应用
  • 恢复出厂设置手机变成砖
  • 网关、DHCP协议、ip地址、子网掩码简单介绍
  • 【AutoencoderKL】基于stable-diffusion-v1.4的vae对图像重构
  • 无障碍快捷方式图标
  • centos7安装jenkins
  • Databricks 收购 Tabular 的意义:数据开放框架的胜利
  • 安全防御---防火墙实验1
  • 医疗器械FDA |FDA网络安全测试具体内容
  • 初识Laravel(Laravel的项目搭建)
  • 基于随机森林与XGBoost模型的机器故障关键因素分析
  • linux系统php开机自启动 phpfpm
  • Tomcat的安全配置
  • 2017 年终总结 —— 在路上
  • CentOS从零开始部署Nodejs项目
  • create-react-app做的留言板
  • HTTP中的ETag在移动客户端的应用
  • java中具有继承关系的类及其对象初始化顺序
  • JS题目及答案整理
  • Laravel Telescope:优雅的应用调试工具
  • Netty 4.1 源代码学习:线程模型
  • quasar-framework cnodejs社区
  • springboot_database项目介绍
  • 分布式熔断降级平台aegis
  • 可能是历史上最全的CC0版权可以免费商用的图片网站
  • 聊聊spring cloud的LoadBalancerAutoConfiguration
  • 前端面试总结(at, md)
  • 如何使用 OAuth 2.0 将 LinkedIn 集成入 iOS 应用
  • 通过几道题目学习二叉搜索树
  • 微信如何实现自动跳转到用其他浏览器打开指定页面下载APP
  • 我这样减少了26.5M Java内存!
  • 写代码的正确姿势
  • 自制字幕遮挡器
  • Mac 上flink的安装与启动
  • ​​​【收录 Hello 算法】10.4 哈希优化策略
  • ​queue --- 一个同步的队列类​
  • ​什么是bug?bug的源头在哪里?
  • # 利刃出鞘_Tomcat 核心原理解析(二)
  • #git 撤消对文件的更改
  • #include到底该写在哪
  • #我与Java虚拟机的故事#连载19:等我技术变强了,我会去看你的 ​
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (1)Jupyter Notebook 下载及安装
  • (4.10~4.16)
  • (仿QQ聊天消息列表加载)wp7 listbox 列表项逐一加载的一种实现方式,以及加入渐显动画...
  • (九十四)函数和二维数组
  • (十一)手动添加用户和文件的特殊权限
  • (四)Linux Shell编程——输入输出重定向
  • (算法)区间调度问题
  • (一)基于IDEA的JAVA基础10
  • (原創) 如何使用ISO C++讀寫BMP圖檔? (C/C++) (Image Processing)
  • (转)可以带来幸福的一本书
  • .net core 客户端缓存、服务器端响应缓存、服务器内存缓存