【前端】一个好看的前端页面

news2024/9/24 9:26:32

序言

突发奇想,看到这个特效还不错,就加工了一下,如果也能帮到你,很开心

先上效果图

部分代码讲解

前端生成uuid

function getUUID(len, radix) {
  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
  var uuid = []
  var i
  radix = radix || chars.length
  if (len) {
    for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
  } else {
    var r
    uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
    uuid[14] = '4'
    for (i = 0; i < 36; i++) {
      if (!uuid[i]) {
        r = 0 | Math.random() * 16
        uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r]
      }
    }
  }
  return uuid.join('')
}

 修改input 原生date icon

   input[type=date]::-webkit-calendar-picker-indicator {
            /*border: 1px solid #0c1622;*/
            /*border-radius: 2px;*/
            /*box-shadow: inset 0 1px #0c1622, 0 1px #0c1622;*/
            /*background-color: #0c1622;*/
            background-image: url("dateicon2.svg");
            /*background-image: -webkit-linear-gradient(top, #f0f0f0, #e6e6e6);*/
            /*color: #0c1622;*/
        }

icon

可以去阿里矢量库下载想要的图标

地址:iconfont-阿里巴巴矢量图标库

我使用的是下面这个,但是颜色是白色,因为整个背景图是深色,图标需要浅色。

其他修改

1. 去掉 date 中上下小三角,但是保留 input 类型为 number 的小三角

     input[type=date]::-webkit-inner-spin-button { visibility: hidden; }

2. 改变日期(文字)的背景色,或添加背景图
  

 input[type=date]::-webkit-datetime-edit { padding: 1px; background: url(../selection.gif); }

3. 改变日期(文字)的背景色,或添加背景图
 

   input[type=date]::-webkit-datetime-edit-fields-wrapper { background-color: #eee; }

4. 改变 年月日 间距 和 连接符颜色

    input[type=date]::-webkit-datetime-edit-text { color: #4D90FE; padding: 0 .3em; }

5. 改变 年 的颜色
  

 input[type=date]::-webkit-datetime-edit-year-field { color: purple; }

6. 改变 月 的颜色
    

input[type=date]::-webkit-datetime-edit-month-field { color: blue; }

7. 改变 日 的颜色
  

 input[type=date]::-webkit-datetime-edit-day-field { color: green; }

8. 改变选择 年月日 按钮
  

  input[type=date]::-webkit-calendar-picker-indicator {
        border: 1px solid #ccc;
        border-radius: 2px;
        box-shadow: inset 0 1px #fff, 0 1px #eee;
        background-color: #eee;
        background-image: -webkit-linear-gradient(top, #f0f0f0, #e6e6e6);
        color: #666;
    }

完整代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入jQuery库文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <!-- 引入Layer弹窗插件的css文件 -->
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/layui/2.5.6/css/layui.min.css">
    <!-- 引入Layer弹窗插件的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/layui/2.5.6/layui.all.js"></script>
    <title>UUID</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        input,
        button {
            background: transparent;
            border: 0;
            outline: none;
        }

        body {
            height: 100vh;
            background: linear-gradient(#141e30, #243b55);
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            color: #03e9f4;
        }

        .loginBox {
            width: 400px;
            height: 600px;
            background-color: #0c1622;
            margin: 100px auto;
            border-radius: 10px;
            box-shadow: 0 15px 25px 0 rgba(0, 0, 0, .6);
            padding: 40px;
            box-sizing: border-box;
        }

        h2 {
            text-align: center;
            color: aliceblue;
            margin-bottom: 30px;
            font-family: 'Courier New', Courier, monospace;
        }

        .item {
            height: 45px;
            border-bottom: 1px solid #fff;
            margin-bottom: 40px;
            position: relative;
        }

        .item input {
            width: 100%;
            height: 100%;
            color: #fff;
            padding-top: 20px;
            box-sizing: border-box;
        }

        .item input:focus+label,
        .item input:valid+label {
            top: 0px;
            font-size: 2px;
        }

        .item label {
            position: absolute;
            left: 0;
            top: 12px;
            transition: all 0.5s linear;
        }

        .btn {
            padding: 10px 20px;
            margin-top: 30px;
            color: #03e9f4;
            position: relative;
            overflow: hidden;
            text-transform: uppercase;
            letter-spacing: 2px;
            left: 35%;
        }

        .btn:hover {
            border-radius: 5px;
            color: #fff;
            background: #03e9f4;
            box-shadow: 0 0 5px 0 #03e9f4,
            0 0 25px 0 #03e9f4,
            0 0 50px 0 #03e9f4,
            0 0 100px 0 #03e9f4;
            transition: all 1s linear;
        }

        .btn>span {
            position: absolute;
        }

        .btn>span:nth-child(1) {
            width: 100%;
            height: 2px;
            background: -webkit-linear-gradient(left, transparent, #03e9f4);
            left: -100%;
            top: 0px;
            animation: line1 1s linear infinite;
        }

        @keyframes line1 {

            50%,
            100% {
                left: 100%;
            }
        }

        .btn>span:nth-child(2) {
            width: 2px;
            height: 100%;
            background: -webkit-linear-gradient(top, transparent, #03e9f4);
            right: 0px;
            top: -100%;
            animation: line2 1s 0.25s linear infinite;
        }

        @keyframes line2 {

            50%,
            100% {
                top: 100%;
            }
        }

        .btn>span:nth-child(3) {
            width: 100%;
            height: 2px;
            background: -webkit-linear-gradient(left, #03e9f4, transparent);
            left: 100%;
            bottom: 0px;
            animation: line3 1s 0.75s linear infinite;
        }

        @keyframes line3 {

            50%,
            100% {
                left: -100%;
            }
        }

        .btn>span:nth-child(4) {
            width: 2px;
            height: 100%;
            background: -webkit-linear-gradient(top, transparent, #03e9f4);
            left: 0px;
            top: 100%;
            animation: line4 1s 1s linear infinite;
        }

        @keyframes line4 {

            50%,
            100% {
                top: -100%;
            }
        }
        .message-box span{

            background: #e3e3e3;
            padding: 15px;
            min-width: 400px;
            text-align: center;
            border-radius: 5px;

        }
        .failure-box span{
            color: #ce3645;
        }
        .success-box span{
            color: #3cca58;
        }
        input[type=date]::-webkit-calendar-picker-indicator {
            /*border: 1px solid #0c1622;*/
            /*border-radius: 2px;*/
            /*box-shadow: inset 0 1px #0c1622, 0 1px #0c1622;*/
            /*background-color: #0c1622;*/
            background-image: url("dateicon2.svg");
            /*background-image: -webkit-linear-gradient(top, #f0f0f0, #e6e6e6);*/
            /*color: #0c1622;*/
        }
    </style>
</head>

<body>
<div class="loginBox">
    <h2>Activation UUID</h2>
        <div class="item">
            <input type="text" id="phoneInput" required>
            <label for="">手机号</label>
        </div>
        <div class="item ">
            <input type="date" id="dateInput">
            <label for="">有效日期</label>
        </div>
        <div class="item">
            <input type="password" id="codeInput" required>
            <label for="">密码</label>
        </div>
       <div onclick="acceptCode()">
           <button class="btn" >生成UUID
               <span></span>
               <span></span>
               <span></span>
               <span></span>
           </button>
       </div>
    <div class="item" style="padding-top: 30px">
        <span>UUID</span>
        <div class="result"></div>
    </div>
</div>
</body>
<script>
    function getUUID(len, radix) {
        var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
        var uuid = []
        var i
        radix = radix || chars.length
        if (len) {
            for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
        } else {
            var r
            uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
            uuid[14] = '4'
            for (i = 0; i < 36; i++) {
                if (!uuid[i]) {
                    r = 0 | Math.random() * 16
                    uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r]
                }
            }
        }
        return uuid.join('')
    };
    function acceptCode(){
        let phoneInput=document.getElementById('phoneInput')
        let dateInput=document.getElementById('dateInput')
        let codeInput=document.getElementById('codeInput')
        let result=document.querySelector(".result")
        const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
        if (!phoneInput.value) {
            layer.alert('请输入手机号!', {
                icon: 2,
                offset: "200px",
                title: '提示'
            });
            return
        }
        if (!reg.test(phoneInput.value)) {
            layer.alert('请输入正确的手机号!', {
                icon: 2,
                offset: "200px",
                title: '提示'
            });
            return
        }
        if (!dateInput.value) {
            layer.alert('请选择有效时间!', {
                icon: 2,
                offset: "200px",
                title: '提示'
            });
            return
        }
        if (!codeInput.value) {
            layer.alert('请输入密码!', {
                icon: 2,
                offset: "200px",
                title: '提示'
            });
            return
        }

        if(true){
            layer.alert('生成成功', {
                icon: 1,
                offset: "200px",
                title: '提示'
            });
            result.innerHTML=getUUID(32, 16)

    }
    }
</script>
</html>

学习参考:

uuid生成

页面效果

页面效果2

针对input[type=date]属性样式的更改

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

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

相关文章

音频相关知识

目录 声音的本质 横波与纵波 为什么固体中既能传输横波&#xff0c;又能传输纵波&#xff0c;液体气体中只能传输纵波 声波 超声波与次声波 声音的三要素 音调 响度 音色 噪声 媒体音频 声道 分类 麦克风工作原理 模数转换 扬声器的使用原理 音频压缩类别 音…

进制数转换知识点总结

二进制和十六进制 用0和1表示各种信息 计算机的电路由逻辑门电路组成。一个逻辑门电路可以看成一个开关&#xff0c;每个开关的状态是“开"&#xff08;高电位&#xff09;或“关”&#xff08;低电位&#xff09;&#xff0c;即对应于1或0 课程推荐 【【计算机科学速成…

gRPC-Go源码解读一 客户端请求链路分析

最近在学习gRPC相关的知识&#xff0c;为啥要学呢&#xff1f;因为一直在用&#xff0c;古人云&#xff0c;“工欲善其事&#xff0c;必先利其器”。为此&#xff0c;花了不少时间阅读gRPC-Go的源码&#xff0c;收货甚多&#xff0c;比如透过服务发现和负载均衡这俩组件来学习复…

腾讯地图获得地图经纬度数据进行描边

场景&#xff1a;地图展示城市或区的描边 方案&#xff1a; 登录腾讯地图 微信小程序JavaScript SDK | 腾讯位置服务 申请密钥 按照步骤获得密钥后 阅读api文档&#xff0c;有各种api获得各类数据 示例&#xff1a;以获得地图区域描边经纬度为例 接口调用&#xff1a;直接浏…

OpenAI最新官方ChatGPT聊天插件接口《插件身份验证》全网最详细中英文实用指南和教程,助你零基础快速轻松掌握全新技术(三)(附源码)

Plugin authentication 插件身份验证 前言Plugin authentication 插件身份验证No authentication 无认证Service level 服务级别User level 用户级别OAuth其它资料下载 前言 “如果你不能信任插件&#xff0c;那么你就不能信任整个应用程序。”正因为如此&#xff0c;ChatGPT始…

机器人中的数值优化(二)—— 凸函数的性质

本系列文章主要是我在学习《数值优化》过程中的一些笔记和相关思考&#xff0c;主要的学习资料是深蓝学院的课程《机器人中的数值优化》和高立编著的《数值最优化方法》等&#xff0c;本系列文章篇数较多&#xff0c;不定期更新&#xff0c;上半部分介绍无约束优化&#xff0c;…

CentOS7(二)Go、Java、Python、Node开发环境配置

文章目录 Go环境配置Java环境配置Python环境配置Node 环境配置 CentOS7&#xff08;一&#xff09;安装和基础配置 CentOS7&#xff08;二&#xff09;Go、Java、Python、Node开发环境配置 根据前文&#xff0c;我们将所有的自定义环境变量&#xff0c;都收拢在了 /root/.bash_…

如何选一款适合企业的进销存软件?这款软件推荐给你

我们先来聊一聊&#xff0c;什么是进销存&#xff1f; 进销存是指企业管理过程中采购&#xff08;进&#xff09;—>入库&#xff08;存&#xff09;—>销售&#xff08;销&#xff09;的动态管理过程。 再来详细拆解下—— 进&#xff1a;指询价、采购到入库与付款的…

Jmeter实验笔记

Jmeter实验 一、基础操作 启动Jmeter 点击bin目录下的&#xff0c;jmeter进行启动 修改界面语言为中文 发起一个最基本的请求 GET请求 线程组&#xff0c;Http请求&#xff0c;察看结果树 提示:参数、消息体数据这两个按钮是互斥的、只要其中一个有数据&#xff…

【配电网重构】【SOE】随机配电网重构中的开关开换方法研究(Matlab代码实现)

&#x1f4a5; &#x1f4a5; &#x1f49e; &#x1f49e; 欢迎来到本博客 ❤️ ❤️ &#x1f4a5; &#x1f4a5; &#x1f3c6; 博主优势&#xff1a; &#x1f31e; &#x1f31e; &#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 …

数组index相同的数组进行合并

index相等的数据进行合并 let formJson [{remind: "请输入电话",sort: 0,title: "电话",type: 1,uuid: "15e343c1-060d-TL51f-8ace-23a968e9e2b9"},{remind: "请输入姓名",sort: 0,title: "姓名",type: 1,uuid: "15e…

文件,IO流,FileInputStream,FileOutputStream,FileReader和FileWriter是字符流

文件就是保存数据的地方文件流&#xff1a;文件在程序中是以流的形式来操作的 java程序&#xff08;内存&#xff09;<-----输入流-----文件&#xff08;磁盘&#xff0c;光盘等&#xff09;java程序&#xff08;内存&#xff09;------输出流----->文件&#xff08;磁盘…

用栈的思想实现将一个十进制数字转换为八进制--数据结构

魔王的介绍&#xff1a;&#x1f636;‍&#x1f32b;️一名双非本科大一小白。魔王的目标&#xff1a;&#x1f92f;努力赶上周围卷王的脚步。魔王的主页&#xff1a;&#x1f525;&#x1f525;&#x1f525;大魔王.&#x1f525;&#x1f525;&#x1f525; ❤️‍&#x1f…

单点定位2米精度?这张卡差点干掉了RTK(内有轨迹对比图)

单点定位2米精度&#xff1f;现在的定位芯片卷成这样了&#xff1f;上面两张卡一款是主打高性能融合定位的星斗3&#xff0c;另一款是主打高性价比高精度低功耗的DNA-1&#xff0c;今天小编给两张定位卡做评测。 话不多说先上轨迹图&#xff1a; 这张图是我们拿着星斗3号RTK定…

小程序封装拖拽菜单组件(uniapp拖拽排序,自定义菜单)

效果展示 思路 使用movable-area作为可移动区域,并在内部循环渲染列表项view,绑定touch事件。在mounted生命周期函数内获取区域movable-area的dom信息,记录列表项的坐标信息。在methods中定义了列表项的touchstart、touchmove和touchend事件的方法,用于实现列表项的拖拽移动和…

偶数社区投稿丨OushuDB学习实践系列(一):开一家超市

大家好&#xff0c;我是镜镜呀&#xff0c;也是一名技术开发人员。本系列内容&#xff0c;也将由技术点出发&#xff0c;从数据库的使用、实践开始&#xff0c;逐步增加对整体的认知&#xff0c;由点及面&#xff0c;真正理解 OushuDB、数据湖仓一体在技术上的变革&#xff0c;…

@Configuration 和 @Component 注解的区别

一句话概括就是 Configuration 中所有带 Bean 注解的方法都会被动态代理&#xff0c;因此调用该方法返回的都是同一个实例。 理解&#xff1a;调用Configuration类中的Bean注解的方法&#xff0c;返回的是同一个示例&#xff1b; 而调用Component类中的Bean注解的方法&#x…

【社区图书馆】携程架构与实践图书

发这篇博文主要是想学习一下携程的架构。携程出了一本《携程架构实践》&#xff0c;无奈现在还没开源。看京东价大概109元人民币。如果看到次博文的网友能发我一本《携程架构实践》pdf。不胜感谢。或者实体书籍也行。其实我不怎么需要实体书籍&#xff0c;因为技术的东西很快会…

使用 IDEA 远程 Debug 调试

背景 有时候我们需要进行远程的debug&#xff0c;本文研究如何进行远程debug&#xff0c;以及使用 IDEA 远程debug的过程中的细节。看完可以解决你的一些疑惑。 配置 远程debug的服务&#xff0c;以springboot微服务为例。首先&#xff0c;启动springboot需要加上特定的参数。…

小白下载以后打不开怎么解决

我们重装系统时&#xff0c;大家会遇到各种各样的问题&#xff0c;现在有一些想用小白一键重装系统工具来帮助自己完成系统重装时&#xff0c;却发现我们打不开这个工具&#xff0c;现在不知道其原因有哪些&#xff0c;那么大家今天就来告诉小伙伴们小白一键重装官网下载以后打…