前端的页面代码

news2024/9/25 17:12:35

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

<!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 | 20110126
   License: 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;
}

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

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1923995.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Gitea 仓库事件触发Jenkins远程构建

文章目录 引言I Gitea 仓库事件触发Jenkins远程构建1.1 Jenkins配置1.2 Gitea 配置引言 应用场景:项目部署 I Gitea 仓库事件触发Jenkins远程构建 Gitea支持用于仓库事件的Webhooks 1.1 Jenkins配置 高版本Jenkins需要关闭跨域限制和开启匿名用户访问 在Jenkins启动前加入…

微前端基础知识

1. 前言 随着Web应用程序规模的日益扩大和复杂性的增加&#xff0c;传统的前端开发模式逐渐显现出其在维护、扩展以及团队协作方面的局限性。微前端作为一种新兴的前端架构模式&#xff0c;正是为了应对这些挑战而诞生的。 微前端&#xff08;Micro-Frontends&#xff09;并没有…

matine组件库踩坑日记 --- react

Mantine实践 一 禁忌核心css样式二 添加轮播图扩展组件 一 禁忌核心css样式 import React from react import ReactDOM from react-dom/client import { BrowserRouter } from react-router-dom; import App from ./App.jsx import ./index.css import mantine/core/styles.cs…

收银系统源码-会员功能

随着新零售时代不断更新迭代&#xff0c;私域会员已经成为很多连锁门店必要的选择。自然离开不了一套能高效管理会员的收银系统。今天给大家推荐一下&#xff0c;智慧新零售收银系统的会员功能。 了解更多查看下文&#xff1a; 门店收银系统源码-CSDN博客文章浏览阅读2.6k次&…

开源项目:机遇与挑战共存的创新之路

开源项目&#xff1a;机遇与挑战共存的创新之路 开源&#xff08;Open Source&#xff0c;开放源码&#xff09;被非盈利软件组织&#xff08;美国的Open Source Initiative协会&#xff09;注册为认证标记&#xff0c;并对其进行了正式的定义&#xff0c;用于描述那些源码可以…

倒计时 2 周!CommunityOverCode Asia 2024 IoT Community 专题部分

CommunityOverCode 是 Apache 软件基金会&#xff08;ASF&#xff09;的官方全球系列大会&#xff0c;其前身为 ApacheCon。自 1998 年以来&#xff0c;在 ASF 成立之前&#xff0c;ApacheCon 已经吸引了各个层次的参与者&#xff0c;在 300 多个 Apache 项目及其不同的社区中探…

线性回归(梯度下降)

首先说案例&#xff1a; 房子的价格和所占面积有着很大的关系&#xff0c;假如现在有一些关于房子面积和价格的数据&#xff0c;我要如何根据已经有的数据来判断未知的数据呢&#xff1f; 假如x(房屋面积)&#xff0c;y(房屋价格) x[ 56 72 69 88 102 86 76 79 94 74] y[92, …

struts2如何防止XSS脚本攻击(XSS防跨站脚本攻击过滤器)

只需要配置一个拦截器即可解决参数内容替换 一、配置web.xml <filter><filter-name>struts-xssFilter</filter-name><filter-class>*.*.filters.XssFilter</filter-class></filter><filter-mapping><filter-name>struts-xss…

1.5.1抽象java入门

前言&#xff1a; 1.5.0版本中&#xff0c;我们熟练使用Git三个可视化操作&#xff08;签出&#xff0c;提交&#xff0c;对比&#xff09;&#xff0c;再加上1.4.0版本的新建&#xff0c;总计使用四个Git可视化操作&#xff1b;对java编程的学习&#xff0c;总结&#xff0c;…

vector 介绍

1.简述vector 首先我们要大致弄明白vector是一个什么东西,其实vector就是之前我们学过的顺序表,这里直接使用就行了. 定义vector-------->vector<typename> arr 此时的这种定义vector可以理解成为一个数组,而typename可以是各种数据类型,比如string,int,double....…

react启用mobx @decorators装饰器语法

react如果没有经过配置&#xff0c;直接使用decorators装饰器语法会报错&#xff1a; Support for the experimental syntax ‘decorators’ isn’t currently enabled 因为react默认是不支持装饰器语法&#xff0c;需要做一些配置来启用装饰器语法。 step1: 在 tsconfig.js…

宪法学学习笔记(个人向) Part.6

宪法学学习笔记(个人向) Part.6 5. 国家机构 概述 国家机构是国家为了实现其管理社会、维护社会秩序职能而建立起来的国家机关的总和&#xff1b;它包括&#xff1a; 立法机关&#xff08;全国人大及其常委会&#xff09;;行政机关&#xff08;国务院和地方人民政府&#xff09…

文心一言:如何备考软考架构师

提问&#xff1a;软考高级:架构师指导&#xff0c;有哪些考点、重点考点有哪些&#xff1f;需要如何备考&#xff1f;案例分析题如何做&#xff1f;论文如何写&#xff1f; 文心一言回答1700字如下&#xff1a; 针对软考高级架构师的考试&#xff0c;以下是对考点、重点考点、备…

33. 322.零钱兑换,279.完全平方数,139.单词拆分,关于多重背包,你该了解这些!,背包问题总结篇!

class Solution { public:int coinChange(vector<int>& coins, int amount) {if(amount 0) return 0;// dp[j]&#xff1a;凑足总额为j所需钱币的最少个数为dp[j]vector<int> dp(amount 1, INT_MAX); //注意初始化方式&#xff01;&#xff01;&#xff01;&…

包管理器冲突-jupyter安装配置

当你使用不同的包管理器安装相同的包&#xff0c;可能存在冲突&#xff0c;比如安装jupyter notebook在本地运行&#xff0c;你可能会遇到这种错误&#xff1a; TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument registry 甚至你可…

客家菜餐馆点菜小程序的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;用户管理&#xff0c;菜系管理&#xff0c;菜品信息管理&#xff0c;我的订单管理&#xff0c;桌号管理&#xff0c;退款信息管理 微信端账号功能包括&#xff1a;系统首页&#xff0c;菜品信息&#…

vue + element ui 实现侧边栏导航栏折叠收起

首页布局如下 要求点击按钮,将侧边栏收缩, 通过 row 和 col 组件&#xff0c;并通过 col 组件的 span 属性我们就可以自由地组合布局。 折叠前 折叠后 <template><div class"app-layout" :class"{ collapse: app.isFold }"><div class&…

医疗级微型导轨:保障医疗行业手术安全!

微型直线导轨能成为一种专为医疗行业设备运用的高精度线性运动设备&#xff0c;在现代医疗领域&#xff0c;精准的位置控制和平稳的运动对于确保医疗设备的高效性能至关重要。那么&#xff0c;医疗行业对微型导轨有哪些要求呢&#xff1f; 1、精度&#xff1a;在手术过程中&…

蔡仲杨摄影入门到高手

描述 蔡仲杨&#xff0c;一个富有才华的老师&#xff01; 对于大家的学习有不可多得的帮助。 内容 目前主要的内容以摄影为主&#xff0c;对于学习摄影有比较大的帮助&#xff01; 但是网络上面错综复杂&#xff0c;很多老旧的版本影响学习&#xff01; 而这里我整理了相关…

小白学python(第七天)

哈哈&#xff0c;这个系列的文章也有一段时间没更新&#xff0c;主要是最近在忙c嘎嘎&#xff0c;不过没事接下来会优先更python啦&#xff0c;那么我们先进入正题吧 函数的定义及调用 函数定义 格式&#xff1a;def 函数名&#xff08;形参列表&#xff09;&#xff1a; 语…