From a676af87b8c60b9c646aad74d15457c9e071b374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B3=89=E9=BE=99?= <3136621936@qq.com> Date: Fri, 26 Nov 2021 17:19:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 36 ---- README.md | 24 --- .../2021-11-17/demo01.html" | 58 ++++++ .../2021-11-18/demo01.html" | 190 ++++++++++++++++++ .../2021-11-19/demo01.html" | 87 ++++++++ .../2021-11-19/demo02.html" | 185 +++++++++++++++++ .../2021-11-24/demo01.html" | 171 ++++++++++++++++ .../2021-11-24/demo02.html" | 185 +++++++++++++++++ .../2021-11-25/demo01.html" | 99 +++++++++ .../2021-11-25/demo02.html" | 30 +++ .../2021-11-26/demo01.html" | 121 +++++++++++ 11 files changed, 1126 insertions(+), 60 deletions(-) delete mode 100644 README.en.md delete mode 100644 README.md create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-17/demo01.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-18/demo01.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-19/demo01.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-19/demo02.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-24/demo01.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-24/demo02.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-25/demo01.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-25/demo02.html" create mode 100644 "\351\273\204\346\263\211\351\276\231/2021-11-26/demo01.html" diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 4f87e52..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# H5-CSS3 - -#### Description -响应式布局课程相关的课件和作业 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 1d439dc..0000000 --- a/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# H5-CSS3 - -#### 介绍 -响应式布局课程相关的课件和作业 - -#### 软件架构 -软件架构说明 - -#### 仓库管理 -1. 请同学们fork本仓库后,然后自行在自己的远程仓库中创建以自己名字命名的文件夹。 -2. 请学委帮忙把之前的课件信息和之后的课件信息及时的更新到课件的文件夹中。同学们无须在个人文件夹中再提交课件信息,避免仓库中相似的内容重复太多次。 -3. 之后大家提交的作业以文件夹为单位。例如:10月10号的作业,文件夹命名:`211010-CSS作业-布局`。 -4. 其他git操作和之前操作一致。 - -> git 指令学习:[廖雪峰的教程](https://www.liaoxuefeng.com/wiki/896043488029600) - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-17/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-17/demo01.html" new file mode 100644 index 0000000..6a14940 --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-17/demo01.html" @@ -0,0 +1,58 @@ + + + + + + Document + + + +
+
+ + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-18/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-18/demo01.html" new file mode 100644 index 0000000..f78d59c --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-18/demo01.html" @@ -0,0 +1,190 @@ + + + + + + Document + + + +

white-space

+ +

word-break

+ +

word-wrap

+ +

word-spacing

+ +

letter-spacing

+ + + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-19/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-19/demo01.html" new file mode 100644 index 0000000..28d613c --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-19/demo01.html" @@ -0,0 +1,87 @@ + + + + + + Document + + + + +

拖动滑块,改变RGB变量:

+

R:

+

G:

+

B:

+ + + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-19/demo02.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-19/demo02.html" new file mode 100644 index 0000000..4ad4f6a --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-19/demo02.html" @@ -0,0 +1,185 @@ + + + + + + Document + + + + +
+

按钮文字颜色随着背景色自动变化实例页面

+ 回到相关文章 » +
+
+

效果:

+
+
+ +

拖动滑块,改变RGB变量:

+

R:

+

G:

+

B:

+
+
+
+
+

代码:

+
+
CSS代码:
+
+        :root {
+          /* 定义RGB变量 */
+          --red: 44;
+          --green: 135;
+          --blue: 255;
+          /* 文字颜色变色的临界值,建议0.5~0.6 */
+          --threshold: 0.5;
+          /* 深色边框出现的临界值,范围0~1,推荐0.8+*/
+          --border-threshold: 0.8;
+        }
+        
+        .btn {
+          font-size: 150%;
+          padding: .5em 2em;
+        }
+        .btn {
+          /* 按钮背景色就是基本背景色 */
+          background: rgb(var(--red), var(--green), var(--blue));
+        
+          /** 
+           * 使用sRGB Luma方法计算灰度(可以看成亮度)
+           * 算法为:
+           * lightness = (red * 0.2126 + green * 0.7152 + blue * 0.0722) / 255
+          */
+          --r: calc(var(--red) * 0.2126);
+          --g: calc(var(--green) * 0.7152);
+          --b: calc(var(--blue) * 0.0722);
+          --sum: calc(var(--r) + var(--g) + var(--b));
+          
+          --lightness: calc(var(--sum) / 255);
+          
+          /**
+           * --lightness近似看成亮度,范围0~1,此时,和临界值--threshold做比较:
+           * 大于,则正数,和-999999%相乘,会得到一个巨大负数,浏览器会按照合法边界0%渲染,也就是亮度为0,于是颜色是黑色;
+           * 小于,则和-999999%相乘,会得到一个巨大的正数,以最大合法值100%渲染,于是颜色是白色;
+          */
+          color: hsl(0, 0%, calc((var(--lightness) - var(--threshold)) * -999999%));
+          
+          /**
+           * 确定边框透明度。
+           * 如果亮度比--border-threshold值大,在说明按钮背景色比较淡,我们出现一个深色边框;
+           * 如果亮度比较小,说明按钮背景色较深,没有必要出现边框。
+             此时,--border-alpha计算后为负值,透明度小于0的时候,浏览器会按照0渲染,因此,边框透明。
+          */
+          --border-alpha: calc((var(--lightness) - var(--border-threshold)) * 100);
+          /* 设置边框相关样式 */
+          border: .2em solid;
+          border-color: rgba(calc(var(--red) - 50), calc(var(--green) - 50), calc(var(--blue) - 50), var(--border-alpha));
+        }
+                        
+
HTML代码:
+
<button class="btn">我是按钮</button>
+        
+        <p>拖动滑块,改变RGB变量:</p>
+        <p>R:<input type="range" min="0" max="255" value="44" name="red"></p>
+        <p>G:<input type="range" min="0" max="255" value="135" name="green"></p>
+        <p>B:<input type="range" min="0" max="255" value="255" name="blue"></p>
+
JS代码:
+
+        var eleRanges = document.querySelectorAll('input[type="range"]');
+        Array.from(eleRanges).forEach(function (range) {
+            range.addEventListener('input', function () {
+                document.documentElement.style.setProperty('--' + this.name, this.value);    
+            });
+        });
+                        
+
+
+
+
+ + + + + + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-24/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-24/demo01.html" new file mode 100644 index 0000000..8a658b9 --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-24/demo01.html" @@ -0,0 +1,171 @@ + + + + + + Document + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-24/demo02.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-24/demo02.html" new file mode 100644 index 0000000..19a2b55 --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-24/demo02.html" @@ -0,0 +1,185 @@ + + + + + Document + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-25/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-25/demo01.html" new file mode 100644 index 0000000..b9bd7a6 --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-25/demo01.html" @@ -0,0 +1,99 @@ + + + + + + Document + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-25/demo02.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-25/demo02.html" new file mode 100644 index 0000000..0d88ceb --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-25/demo02.html" @@ -0,0 +1,30 @@ + + + + + + Document + + + +
+ + +
+ + \ No newline at end of file diff --git "a/\351\273\204\346\263\211\351\276\231/2021-11-26/demo01.html" "b/\351\273\204\346\263\211\351\276\231/2021-11-26/demo01.html" new file mode 100644 index 0000000..3811c5a --- /dev/null +++ "b/\351\273\204\346\263\211\351\276\231/2021-11-26/demo01.html" @@ -0,0 +1,121 @@ + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file -- Gitee