浏览代码

html+css+js快速入门

admin 1 年之前
父节点
当前提交
69c0ce0f6f

+ 26 - 3
html+css+js快速入门/07css常见属性.html

@@ -16,7 +16,11 @@
 
         /*字体底色*/
         background-color: #eb7350;
-        /*......*/
+
+        /*行高*/
+        line-height: 40px;
+
+
       }
 
 
@@ -26,12 +30,31 @@
 
 
 
-    <h1 style="font: caption;">font的复合属性</h1>
-    <h1 style=";">font的复合属性</h1>
+    <h3 style="font: caption;">font的复合属性</h3>
+    <h3 style=";">font的复合属性</h3>
+
+<h1>行内元素、块级元素、行内块级元素的相互转换</h1>
+
+    <h5 style="color: #ff5722">
+        <p>1.使用style="display: inline"转换为行内元素</p>
+        <p>2.style="display: block"转换为块级元素</p>
+        <p>3.style="display: inline-block转换为行内块级元素"</p>
+    </h5>
+    <hr>
+copyright: <p>Copyright &copy; 2022~ <script>document.write(new Date().getFullYear());</script> <a href="https://grd.net.cn" target="_blank">G.R.D</a> All Rights Reserved.</p> # 左下角的版权声明
 
 
 
+<div style="background-color: #a1aec6;width: 100px; height: 100px">
+        这是一个块级元素
+</div>
 
+<div style="display: inline; background-color: #d3ffe2;width: 100px; height: 100px">
+        这是一个块级元素
+</div>
+<div style="display: inline-block; background-color: #fbd3ff;width: 100px; height: 100px">
+        这是一个块级元素
+</div>
 
 </body>
 </html>

+ 39 - 0
html+css+js快速入门/08盒子模型.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>盒子模型</title>
+</head>
+<body>
+
+<h3 style="">内边距</h3>
+
+    <div style=
+                 "width: 100px;
+
+                  /*padding内边距*/
+                  padding: 10px 20px 30px 40px;
+                  border: 10px  solid darkred;
+                  background-color: #f59b81;
+
+
+"
+                  >
+    合适内边距
+
+    </div>
+
+
+<h3>边框</h3>
+<h3>外边距</h3>
+
+
+<p></p>
+
+
+
+
+
+
+</body>
+</html>

+ 19 - 0
html+css+js快速入门/11JS的导入方式.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>JS的导入方式</title>
+    <script src="11JS的导入方式.js"></script>
+</head>
+<body>
+<H1>JS的导入方式</H1>
+
+<script>
+    console.log('这是内部样式的控制台打印')
+    alert("sddas")
+</script>
+
+
+
+</body>
+</html>

+ 3 - 0
html+css+js快速入门/11JS的导入方式.js

@@ -0,0 +1,3 @@
+alert(
+    "这是一个外部样式"
+)

+ 42 - 0
html+css+js快速入门/12JS基本语法.html

@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>JS基本语法</title>
+</head>
+<body>
+
+<h1>这是变量定义</h1>
+<script>
+    // lat、var都是申明变量的意思
+    let x;
+    var y=1;
+
+    // 常量
+    const PI = 3.5;
+
+    console.log(x,y,PI)
+    alert(PI)
+
+</script>
+
+<h1>第二个变量</h1>
+
+<script>
+    let name = '这是一个字符串变量'
+    console.log(name)
+
+    // underfind:被定义但是未赋值(或者无返回值)
+    // NULL:明确定义的内容是空
+
+
+
+</script>
+
+
+
+
+
+
+</body>
+</html>

+ 43 - 0
html+css+js快速入门/13JS函数.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+</head>
+<body>
+<p>
+    函数
+JavaScript 函数
+输入 (参数)、执行特定任务,并返回输出。函数是一段可重复使用的代码块,它接受
+1
+23
+..)[ // 参数可以不写,表示不传参function function name(参数1,参数2,参数3
+// 函数体,执行这里的代码
+return 返回值;// 可选,返回值
+
+</p>
+
+<script>
+    <!--    事例一     -->
+    //创建函数
+    function hello(){
+        console.log("这是定义的第一个函数hello")
+    }
+    //调用函数
+    hello();
+
+
+    // 事例二
+    function hellow_name(user){
+        console.log('hello' + user)
+
+        return '这是一个hello_name的返回值'
+    }
+    //使用函数和使用函数的返回值
+    hellow_name("如画")
+    let m = hellow_name()
+    console.log(m)
+</script>
+
+</body>
+</html>

+ 31 - 0
html+css+js快速入门/14事件处理.html

@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>14事件处理</title>
+</head>
+<body>
+
+<h1>这是事件处理</h1>
+    <button onclick="button_onClick()">这是一个点击事件</button>
+    <script>
+        function button_onClick(){
+            alert("这是点击事件的提示")
+        }
+    </script>
+
+<h1>输入框聚焦失焦</h1>
+
+<input type="text" onblur="shijiao()" onfocus="jujiao()">
+
+<script !src="">
+    function jujiao(){
+        alert('这是聚焦事件')
+    }
+    function shijiao(){
+        alert('这是失去焦点事件')
+    }
+</script>
+
+</body>
+</html>

+ 305 - 0
html+css+js快速入门/404.html

@@ -0,0 +1,305 @@
+
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>走丢了</title>
+
+    <style>
+        html, body {
+            height: 100%;
+            min-height: 450px;
+            font-size: 32px;
+            font-weight: 500;
+            color: #5d7399;
+            margin: 0;
+            padding: 0;
+            border: 0;
+        }
+
+        .content {
+            height: 100%;
+            position: relative;
+            z-index: 1;
+            background-color: #d2e1ec;
+            background-image: -webkit-linear-gradient(top, #bbcfe1 0%, #e8f2f6 80%);
+            background-image: linear-gradient(to bottom, #bbcfe1 0%, #e8f2f6 80%);
+            overflow: hidden;
+        }
+
+        .snow {
+            position: absolute;
+            top: 0;
+            left: 0;
+            pointer-events: none;
+            z-index: 20;
+        }
+
+        .main-text {
+            padding: 20vh 20px 0 20px;
+            text-align: center;
+            line-height: 2em;
+            font-size: 5vh;
+        }
+
+        .main-text h1 {
+            font-size: 45px;
+            line-height: 48px;
+            margin: 0;
+            padding: 0;
+        }
+
+        .main-text-a {
+            height: 32px;
+            margin-left: auto;
+            margin-right: auto;
+            text-align: center;
+        }
+
+        .main-text-a a {
+            font-size: 16px;
+            text-decoration: none;
+            color: #0066CC;
+        }
+
+        .main-text-a a:hover {
+            color: #000;
+        }
+
+        .home-link {
+            font-size: 0.6em;
+            font-weight: 400;
+            color: inherit;
+            text-decoration: none;
+            opacity: 0.6;
+            border-bottom: 1px dashed rgba(93, 115, 153, 0.5);
+        }
+
+        .home-link:hover {
+            opacity: 1;
+        }
+
+        .ground {
+            height: 160px;
+            width: 100%;
+            position: absolute;
+            bottom: 0;
+            left: 0;
+            background: #f6f9fa;
+            box-shadow: 0 0 10px 10px #f6f9fa;
+        }
+
+        .ground:before, .ground:after {
+            content: '';
+            display: block;
+            width: 250px;
+            height: 250px;
+            position: absolute;
+            top: -62.5px;
+            z-index: -1;
+            background: transparent;
+            -webkit-transform: scaleX(0.2) rotate(45deg);
+            transform: scaleX(0.2) rotate(45deg);
+        }
+
+        .ground:after {
+            left: 50%;
+            margin-left: -166.66667px;
+            box-shadow: -340px 260px 15px #8193b2, -620px 580px 15px #8193b2, -900px 900px 15px #b0bccf, -1155px 1245px 15px #b4bed1, -1515px 1485px 15px #8193b2, -1755px 1845px 15px #8a9bb8, -2050px 2150px 15px #91a1bc, -2425px 2375px 15px #bac4d5, -2695px 2705px 15px #a1aec6, -3020px 2980px 15px #8193b2, -3315px 3285px 15px #94a3be, -3555px 3645px 15px #9aa9c2, -3910px 3890px 15px #b0bccf, -4180px 4220px 15px #bac4d5, -4535px 4465px 15px #a7b4c9, -4840px 4760px 15px #94a3be;
+        }
+
+        .ground:before {
+            right: 50%;
+            margin-right: -166.66667px;
+            box-shadow: 325px -275px 15px #b4bed1, 620px -580px 15px #adb9cd, 925px -875px 15px #a1aec6, 1220px -1180px 15px #b7c1d3, 1545px -1455px 15px #7e90b0, 1795px -1805px 15px #b0bccf, 2080px -2120px 15px #b7c1d3, 2395px -2405px 15px #8e9eba, 2730px -2670px 15px #b7c1d3, 2995px -3005px 15px #9dabc4, 3285px -3315px 15px #a1aec6, 3620px -3580px 15px #8193b2, 3880px -3920px 15px #aab6cb, 4225px -4175px 15px #9dabc4, 4510px -4490px 15px #8e9eba, 4785px -4815px 15px #a7b4c9;
+        }
+
+        .mound {
+            margin-top: -80px;
+            font-weight: 800;
+            font-size: 180px;
+            text-align: center;
+            color: #dd4040;
+            pointer-events: none;
+        }
+
+        .mound:before {
+            content: '';
+            display: block;
+            width: 600px;
+            height: 200px;
+            position: absolute;
+            left: 50%;
+            margin-left: -300px;
+            top: 50px;
+            z-index: 1;
+            border-radius: 100%;
+            background-color: #e8f2f6;
+            background-image: -webkit-linear-gradient(top, #dee8f1, #f6f9fa 60px);
+            background-image: linear-gradient(to bottom, #dee8f1, #f6f9fa 60px);
+        }
+
+        .mound:after {
+            content: '';
+            display: block;
+            width: 28px;
+            height: 6px;
+            position: absolute;
+            left: 50%;
+            margin-left: -150px;
+            top: 68px;
+            z-index: 2;
+            background: #dd4040;
+            border-radius: 100%;
+            -webkit-transform: rotate(-15deg);
+            transform: rotate(-15deg);
+            box-shadow: -56px 12px 0 1px #dd4040, -126px 6px 0 2px #dd4040, -196px 24px 0 3px #dd4040;
+        }
+
+        .mound_text {
+            -webkit-transform: rotate(6deg);
+            transform: rotate(6deg);
+        }
+
+        .mound_spade {
+            display: block;
+            width: 35px;
+            height: 30px;
+            position: absolute;
+            right: 50%;
+            top: 42%;
+            margin-right: -250px;
+            z-index: 0;
+            -webkit-transform: rotate(35deg);
+            transform: rotate(35deg);
+            background: #dd4040;
+        }
+
+        .mound_spade:before, .mound_spade:after {
+            content: '';
+            display: block;
+            position: absolute;
+        }
+
+        .mound_spade:before {
+            width: 40%;
+            height: 30px;
+            bottom: 98%;
+            left: 50%;
+            margin-left: -20%;
+            background: #dd4040;
+        }
+
+        .mound_spade:after {
+            width: 100%;
+            height: 30px;
+            top: -55px;
+            left: 0%;
+            box-sizing: border-box;
+            border: 10px solid #dd4040;
+            border-radius: 4px 4px 20px 20px;
+        }
+    </style>
+
+</head>
+
+<body translate="no">
+<div class="content">
+    <canvas class="snow" id="snow" width="1349" height="400"></canvas>
+    <div class="main-text">
+        <h1>没有任何东西哦~ ~<br><br>您好像去了一个不存在的地方! (灬ꈍ ꈍ灬)</h1>
+        <!-- <div class="main-text-a"><a href="#">< 返回 首页</a></div> -->
+    </div>
+    <div class="ground">
+        <div class="mound">
+            <div class="mound_text">null</div>
+            <div class="mound_spade"></div>
+        </div>
+    </div>
+</div>
+
+
+<script>
+    (function () {
+        function ready(fn) {
+            if (document.readyState != 'loading') {
+                fn();
+            } else {
+                document.addEventListener('DOMContentLoaded', fn);
+            }
+        }
+
+        function makeSnow(el) {
+            var ctx = el.getContext('2d');
+            var width = 0;
+            var height = 0;
+            var particles = [];
+
+            var Particle = function () {
+                this.x = this.y = this.dx = this.dy = 0;
+                this.reset();
+            }
+
+            Particle.prototype.reset = function () {
+                this.y = Math.random() * height;
+                this.x = Math.random() * width;
+                this.dx = (Math.random() * 1) - 0.5;
+                this.dy = (Math.random() * 0.5) + 0.5;
+            }
+
+            function createParticles(count) {
+                if (count != particles.length) {
+                    particles = [];
+                    for (var i = 0; i < count; i++) {
+                        particles.push(new Particle());
+                    }
+                }
+            }
+
+            function onResize() {
+                width = window.innerWidth;
+                height = window.innerHeight;
+                el.width = width;
+                el.height = height;
+
+                createParticles((width * height) / 10000);
+            }
+
+            function updateParticles() {
+                ctx.clearRect(0, 0, width, height);
+                ctx.fillStyle = '#f6f9fa';
+
+                particles.forEach(function (particle) {
+                    particle.y += particle.dy;
+                    particle.x += particle.dx;
+
+                    if (particle.y > height) {
+                        particle.y = 0;
+                    }
+
+                    if (particle.x > width) {
+                        particle.reset();
+                        particle.y = 0;
+                    }
+
+                    ctx.beginPath();
+                    ctx.arc(particle.x, particle.y, 5, 0, Math.PI * 2, false);
+                    ctx.fill();
+                });
+
+                window.requestAnimationFrame(updateParticles);
+            }
+
+            onResize();
+            updateParticles();
+        }
+
+        ready(function () {
+            var canvas = document.getElementById('snow');
+            makeSnow(canvas);
+        });
+    })();
+</script>
+
+</body>
+</html>