无际线复选框

效果演示

24-无际线复选框.gif

实现了一个网格布局,其中每个网格是一个复选框,可以选择是否显示。每个复选框都有一个漂浮的天花板,表示它是一个房间的天花板。每个房间的天花板都有一个不同的形状和颜色,分别对应不同的房间。整个页面的背景是一个由两种颜色组成的渐变背景,其中一种颜色在页面顶部,另一种颜色在页面底部。整个页面的布局非常简洁,适合用于显示房间的天花板和选择是否显示。

Code

<form>
        <fieldset class="roof left">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
        </fieldset>
    
        <fieldset class="roof" style="--windows:2;">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
        </fieldset>
    
        <fieldset class="roof center" style="--windows:2;gap:1vw;">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
        </fieldset>
    
        <fieldset class="roof" style="--windows:3;--gap:1.5vw;">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
        </fieldset>
    
        <fieldset class="roof antenna" style="--gap:.75vw;">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox">
            <input type="checkbox" checked>
            <input type="checkbox">
        </fieldset>
    </form>
body {
    background: linear-gradient(200deg, hsl(190, 10%, 10%), hsl(220, 30%, 30%)) no-repeat;
    background-attachment: fixed;
    display: grid;
    height: 100%;
    margin: 0;
    padding: 0 1vw;
}

fieldset {
    background: hsl(190, 10%, 10%);
    border: 0;
    display: grid;
    gap: var(--gap, 2vw);
    grid-template-columns: repeat(var(--windows, 4), 1fr);
    margin: 0;
    padding: var(--p, 3vw 2vw);
    position: relative;
}

[type=checkbox] {
    all: unset;
    aspect-ratio: 1 / 1.25;
    background: hsl(190, 10%, 20%);
    transition: background .3s ease-in;
    width: 100%;

    &:checked {
        background: #ffffae;
    }
}

form {
    align-items: end;
    align-self: end;
    display: grid;
    gap: 1vw;
    grid-auto-flow: column;
    max-height: 85vh;
}

html {
    display: grid;
    min-height: 100vh;
}

/* Roofs */
.antenna {
    --asr: 1 / 1;
    --clp: polygon(25% 100%, 25% 75%, 45% 75%, 45% 0, 55% 0%, 55% 75%, 75% 75%, 75% 100%);
}

.center {
    --asr: 1 / .4;
    --clp: polygon(0 100%, 50% 0, 100% 100%);
}

.left {
    --asr: 1 / .25;
    --clp: polygon(0 0, 100% 100%, 0 100%);
}

.roof {
    &::before {
        aspect-ratio: var(--asr, 1 / .4);
        background-color: inherit;
        clip-path: var(--clp, polygon(0 100%, 100% 0, 100% 100%));
        content: "";
        position: absolute;
        bottom: calc(100% - 1px);
        width: 100%;
    }
}

实现思路拆分

body {
  background: linear-gradient(200deg, hsl(190, 10%, 10%), hsl(220, 30%, 30%)) no-repeat;
  background-attachment: fixed;
  display: grid;
  height: 100%;
  margin: 0;
  padding: 0 1vw;
}

这段代码定义了页面的样式。其中,background属性定义了页面的背景,使用了渐变背景,其中第一组颜色为hsl(190, 10%, 10%),第二组颜色为hsl(220, 30%, 30%),使用了linear-gradient函数。background-attachment属性设置为fixed,表示背景不会随着页面滚动而移动。display属性设置为grid,表示使用网格布局。height属性设置为100%,表示页面的高度为整个屏幕的高度。margin属性设置为0,表示页面没有外边距。padding属性设置为0 1vw,表示页面的内边距为左右各1vw。

fieldset {
  background: hsl(190, 10%, 10%);
  border: 0;
  display: grid;
  gap: var(--gap, 2vw);
  grid-template-columns: repeat(var(--windows, 4), 1fr);
  margin: 0;
  padding: var(--p, 3vw 2vw);
  position: relative;
}

这段代码定义了复选框的样式。其中,background属性定义了复选框的背景,使用了hsl(190, 10%, 10%)border属性设置为0,表示复选框没有边框。display属性设置为grid,表示使用网格布局。gap属性设置为var(--gap, 2vw),表示网格之间的间距,如果没有设置--gap变量,则默认为2vw。grid-template-columns属性设置为repeat(var(--windows, 4), 1fr),表示网格的列数,如果没有设置--windows变量,则默认为4列。margin属性设置为0,表示复选框没有外边距。padding属性设置为var(--p, 3vw 2vw),表示复选框的内边距,如果没有设置--p变量,则默认为3vw 2vw。position属性设置为relative,表示复选框的定位方式为相对定位。

[type=checkbox] {
  all: unset;
  aspect-ratio: 1 / 1.25;
  background: hsl(190, 10%, 20%);
  transition: background.3s ease-in;
  width: 100%;

  &:checked {
    background: #ffffae;
  }
}

这段代码定义了复选框的样式。其中,all: unset;表示清除所有默认样式。aspect-ratio属性设置为1 / 1.25,表示复选框的宽高比为1:1.25。background属性定义了复选框的背景,使用了hsl(190, 10%, 20%)transition属性定义了复选框的过渡效果,表示背景颜色的变化效果需要300毫秒,使用了ease-in函数。width属性设置为100%,表示复选框的宽度为100%。:checked伪类表示复选框被选中时的样式,其中background属性定义了复选框被选中的背景颜色,使用了#ffffae

form {
  align-items: end;
  align-self: end;
  display: grid;
  gap: 1vw;
  grid-auto-flow: column;
  max-height: 85vh;
}

这段代码定义了复选框的样式。其中,align-items: end;表示表单元素在交叉轴上对齐方式为右对齐。align-self: end;表示表单元素在交叉轴上对齐方式为右对齐。display属性设置为`grid

html {
  display: grid;
  min-height: 100vh;
}

这段代码定义了整个页面的样式。其中,display属性设置为grid,表示使用网格布局。min-height属性设置为100vh,表示页面的最小高度为整个屏幕的高度。

.antenna {
  --asr: 1 / 1;
  --clp: polygon(25% 100%, 25% 75%, 45% 75%, 45% 0, 55% 0%, 55% 75%, 75% 75%, 75% 100%);
}

.center {
  --asr: 1 /.4;
  --clp: polygon(0 100%, 50% 0, 100% 100%);
}

.left {
  --asr: 1 /.25;
  --clp: polygon(0 0, 100% 100%, 0 100%);
}

.roof {
  &::before {
    aspect-ratio: var(--asr, 1 /.4);
    background-color: inherit;
    clip-path: var(--clp, polygon(0 100%, 100% 0, 100% 100%));
    content: "";
    position: absolute;
    bottom: calc(100% - 1px);
    width: 100%;
  }
}

这段代码定义了房间的天花板的样式。其中,.antenna类定义了天花板的样式,其中--asr变量定义了天花板的宽高比,--clp变量定义了天花板的形状。.center类定义了中央天花板的样式,其中--asr变量定义了天花板的宽高比,--clp变量定义了天花板的形状。.left类定义了左侧天花板的样式,其中--asr变量定义了天花板的宽高比,--clp变量定义了天花板的形状。.roof类定义了房屋的屋顶的样式,其中::before伪元素定义了房屋的屋顶的背景,其中aspect-ratio属性定义了背景的宽高比,background-color属性定义了背景的颜色,clip-path属性定义了背景的形状,content属性定义了伪元素的内容,position属性定义了伪元素的定位方式,bottom属性定义了伪元素距离底部的距离,width属性定义了伪元素的宽度。

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

小米13utltra激活冰箱

安装adb驱动https://www.jianshu.com/p/6c41d34d9202 直接下载使用 连接上小米手机,退出账号,关闭锁屏密码,打开usb调试,usb调试(安全设置) adb shell dpm set-device-owner com.catchingnow.icebox/.receiver.DPMReceiver如果显示Success&#xff0c;则您已成功激活冰箱。 …

【DeepLearning-8】MobileViT模块配置

完整代码&#xff1a; import torch import torch.nn as nn from einops import rearrange def conv_1x1_bn(inp, oup):return nn.Sequential(nn.Conv2d(inp, oup, 1, 1, 0, biasFalse),nn.BatchNorm2d(oup),nn.SiLU()) def conv_nxn_bn(inp, oup, kernal_size3, stride1):re…

PostgreSQL技术大讲堂 - 第43讲:流复制原理

PostgreSQL从小白到专家&#xff0c;是从入门逐渐能力提升的一个系列教程&#xff0c;内容包括对PG基础的认知、包括安装使用、包括角色权限、包括维护管理、、等内容&#xff0c;希望对热爱PG、学习PG的同学们有帮助&#xff0c;欢迎持续关注CUUG PG技术大讲堂。 第43讲&#…

每日OJ题_算法_二分查找⑦_力扣153. 寻找旋转排序数组中的最小值

目录 力扣153. 寻找旋转排序数组中的最小值 解析代码 力扣153. 寻找旋转排序数组中的最小值 153. 寻找旋转排序数组中的最小值 - 力扣&#xff08;LeetCode&#xff09; 难度 中等 已知一个长度为 n 的数组&#xff0c;预先按照升序排列&#xff0c;经由 1 到 n 次 旋转 后…

Java NIO初体验

概述 由于BIO&#xff08;同步阻塞IO&#xff09;对系统资源的浪费较大。Java1.4中引⼊了NIO框架&#xff0c;在java.nio包中提供了Channel、Selector、Buffer等抽象类&#xff0c;可以快速构建多路复⽤的IO程序&#xff0c;⽤于提供更接近操作系统底层的⾼性能数据操作⽅式。…

11. 双目视觉之立体视觉基础

目录 1. 深度恢复1.1 单目相机缺少深度信息1.2 如何恢复场景深度&#xff1f;1.3 深度恢复的思路 2. 对极几何约束2.1 直观感受2.2 数学上的描述 1. 深度恢复 1.1 单目相机缺少深度信息 之前学习过相机模型&#xff0c;最经典的就是小孔成像模型。我们知道相机通过小孔成像模…

零基础轻松学编程,中文编程开发工具下载及构件教程

零基础轻松学编程&#xff0c;中文编程开发工具下载及构件教程 一、前言 零基础学编程&#xff0c;中文编程工具下载&#xff0c;中文编程开发工具构件之选择件列表框构件教程&#xff0c; 想学编程可 编程交流.群.一起交流学习&#xff08;关注收藏或点击最下方官网卡片进入…

【c语言】详解操作符(上)

1. 操作符的分类 2. 原码、反码、补码 整数的2进制表示方法有三种&#xff0c;即原码、反码、补码 有符号整数的三种表示方法均有符号位和数值位两部分&#xff0c;2进制序列中&#xff0c;最高位的1位是被当做符号位其余都是数值位。 符号位都是用0表示“正”&#xff0c;用…

设计模式:简介及基本原则

简介 设计模式是一套被反复使用的、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了重用代码、让代码更容易被他人理解、保证代码可靠性。 毫无疑问&#xff0c;设计模式于己于他人于系统都是多赢的&#xff0c;设计模式使代码编制真正工程化&#xff…

Kotlin快速入门5

Kotlin的继承与重写 kotlin的继承 Kotlin中所有类都继承自Any类&#xff0c;Any类是所有类的超类&#xff0c;对于没有超类型声明的类是默认超类&#xff08;Any 不是 java.lang.Object&#xff09;&#xff1a; class LearnKotlin // 默认继承自Any Any类默认提供三个函数…

Scikit-learn (sklearn)速通 -【莫凡Python学习笔记】

视频教程链接&#xff1a;【莫烦Python】Scikit-learn (sklearn) 优雅地学会机器学习 视频教程代码 scikit-learn官网 莫烦官网学习链接 本人matplotlib、numpy、pandas笔记 1 为什么学习 Scikit learn 也简称 sklearn, 是机器学习领域当中最知名的 python 模块之一. Sk…

IDEA搭建JDK源码学习环境(可添加注释、修改、debug)

工程详见&#xff1a;https://github.com/wenpanwenpan/study-source-jdk1.8.0_281 1、找到src.zip和javafx-src.zip 找到你想要调试的JDK&#xff0c;笔者本地电脑上装了两个版本的JDK&#xff0c;这里以jdk1.8.0_281为例将JDK目录下的javafx-src.zip和src.zip两个压缩包进行…

【GitHub项目推荐--不错的 TypeScript 学习项目】【转载】

在线白板工具 Excalidraw 标星 33k&#xff0c;是一款非常轻量的在线白板工具&#xff0c;可以直接在浏览器打开&#xff0c;轻松绘制具有手绘风格的图形。 如下图所示&#xff0c;Excalidraw 支持最常用的图形元素&#xff1a;方框、圆、菱形、线&#xff0c;可以方便的使用…

【Web】小白也能做的RWCTF体验赛baby题部分wp

遇到不会的题&#xff0c;怎么办&#xff01;有的师傅告诉你完了&#xff0c;废了&#xff0c;寄了&#xff01;只有Z3告诉你&#xff0c;稳辣&#xff01;稳辣&#xff01;都稳辣&#xff01; 这种CVE复现的题型&#xff0c;不可能要求选手从0到1进行0day挖掘&#xff0c;其实…

12.15字符编码(血干JAVA系列)

字符编码 12.15.1 Java常见编码简介12.15.2得到本机的编码显示【例12.68】使用上述方法得到JVM的默认编码 12.15.3乱码产生【例12.69】使用1SO8859-1编码 12.15.1 Java常见编码简介 12.15.2得到本机的编码显示 在 前 面 讲 解 常 用 类 库 的 时 候 曾 经 介 绍 过 &#xff0…

HarmonyOS 沉浸式状态栏实现

比如说 我们代码是这样的 Entry Component struct Index {build() {Column() {Column() {Column() {Text(定标标题).fontSize(20).fontColor(Color.White)}.height(50).justifyContent(FlexAlign.Center)}.width(100%).backgroundColor(#FF0000)}.height(100%)} }你预览器上看…

k8s 版本发布与回滚

一、实验环境准备&#xff1a; kubectl get pods -o wide kubectl get nodes -o wide kubectl get svc 准备两个nginx镜像&#xff0c;版本号一个是V3&#xff0c;一个是V4 二、准备一个nginx.yaml文件 apiVersion: apps/v1 kind: Deployment metadata:name: nginx-deploylab…

AutoGen实战应用(二):多代理协作(Multi-Agent Collaboration)

AutoGen是微软推出的一个全新工具&#xff0c;它用来帮助开发者创建基于大语言模型(LLM)的复杂应用程序. AutoGen能让LLM在复杂工作流程启用多个角色代理来共同协作完成人类提出的任务。在我之前的一篇博客: AutoGen实战应用(一)&#xff1a;代码生成、执行和调试 中我们通过一…

CTF CRYPTO 密码学-6

题目名称&#xff1a;敲击 题目描述&#xff1a; 方方格格&#xff0c;不断敲击 “wdvtdz qsxdr werdzxc esxcfr uygbn” 解题过程&#xff1a; step1&#xff1a;根据题目描述敲击&#xff0c;wdvtdz对应的字符为x step2&#xff1a;依此类推r&#xff0c;z&#xff0c;o&…

使用 create-react-app 创建 react 应用

一、创建项目并启动 第一步&#xff1a;全局安装&#xff1a;npm install -g create-react-app 第二步&#xff1a;切换到想创建项目的目录&#xff0c;使用命令create-react-app hello-react 第三步&#xff1a;进入项目目录&#xff0c;cd hello-react 第四步&#xff1a;启…
最新文章