首页 > 其他分享 >2022-8-23 第一组 (≥▽≤)

2022-8-23 第一组 (≥▽≤)

时间:2022-08-23 18:44:28浏览次数:55  
标签:2022 23 第一组 height width background 200px border left

目录

1.CSS

css三大特性

  • 层叠性
    • 一个标签可以有多个css样式
    • 浏览器处理冲突的能力,如果一个属性通过两个相同的选择器设置到这个元素上,会根据样式的层叠规则
    • 样式的层叠规则——按照样式的声明顺序来层叠的【就近原则】
      • 选择器必须是同一种
      • 样式不冲突不会层叠
  • 继承性
    • 子标签会继承父标签的某些样式,比如文本颜色和字号
  • 优先级
    • 权重
      1. 继承的权重是0——最低
      2. 行内样式的权重是100
      3. 权重相同的——就近原则
      4. !important命令——无限大
    • css权重公式——贡献值
      • 继承、*——0000
      • 标签选择器——0001
      • 类、伪类选择器——0010
      • id选择器——0100
      • 行内样式——1000
      • !important——无穷大
      • width,height——大于无穷大
    • 权重不能被继承
      • 贡献值是没有进位的
    • 如果同时有!important与max-width,max-height
      • !important是不管用的

常用单位

  • px像素:最常用
  • em:绝对单位,由父类的字号决定,比如父级的字号是16px,可以设置成2em(32px)
  • rem:绝对单位,由整个html的字号决定的,页面的字号也会发生变化
  • 百分比:相对于父元素的比例

字体大小

  •     /* 字体大小 */
        font-size: 20px;
        /* 字体样式 */
        font-style: italic;
        /* 字体粗细 */
        font-weight: bold;
        /* 字体修饰 */
        text-decoration:line-through;
        /* 字体 */
        font-family: monospace;
        /* 复合属性 */
        font: 130px italic bolder ;
    

背景

  • 一般情况下不要既有背景颜色又有背景图片

  •     /* 背景颜色 */
        /* background-color: rgba(255,255,0); */
        /* 设置颜色可以用——英语、十六进制、如果部、rgb、rgba */
        width: 1200px;
        height: 1200px;
        /* 背景图片 */
        background-image: url(../../2022-8-22/morning/img/a.webp);
        /* 背景大小 */
        background-size: 1200px;
        /* 背景图片不重复 */
        background-repeat:no-repeat;
        /* 背景的位置 */
        background-position: center;
    

列表

            list-style-type:lower-greek;
            list-style-image: url(../../2022-8-22/morning/img/a.webp);

圆角

            width: 200px;
            height: 200px;
            background-color: yellow;
            /* 圆角 */
            border-radius:15px;
            /* 左下圆角 */
            border-bottom-left-radius: 68px;
            /* 虚线 */
            border-style: dashed;

区块属性

<style>
        div{
            height: 300px;
            width: 300px;
            background: yellow;
            /* 显示方式块级变为行级 */
            display: inline;
        }
        span{
            height: 200px;
            width: 200px;
            background: orange;
            /* 显示方式行级变为块级 */
            display: block;
            /* 显示方式隐藏 */
            /* display: none; */
            /* 内联块 */
            display: inline-block;
        }
    </style>

盒子模型

            width: 300px;
            height: 300px;
            background: rgb(238, 107, 107);
            /* 外边距 */
            margin : 100px;
            /* 盒子的边框线宽度,颜色,边框线 */
            border: 10px blueviolet solid;
            /* 内边距 */
            padding-top: 10px;
            /* 保证盒子的大小是300*300 盒子的外边距是 不包括的 */
            box-sizing: border-box;
            /* 保证当前div的尺寸是300*300 不包含内边距和边框线 */
            box-sizing: content-box;

image-20220823113747393

定位

文档流

  • 在网页中将窗体自上到下的分成多行
  • 在每一行从左到右的顺序排列元素——即为文档流
  • 网页默认的布局方式

定位position

  • static:文档流,默认的

  • absolute:绝对定位

    • 相对于一个父元素的绝对定位
    • 当设置了绝对定位之后,原来的元素脱离了文档流。会在页面上浮起来。
  • relative:相对定位

    • 相对于上一个元素的位置的定位
  • fixed:固定定位

    •             /* 居中 */
                  margin: center;
                  /* 固定定位 */
                  position: fixed;
                  /* z轴的索引 */
                  z-index:1080;
      

【子绝父相】

  • 子元素是绝对定位
  • 父元素是相对定位

【定位left与盒子模型margin-left有什么区别】

  • 定位left是相对于父元素的位置,margin是相对于自己的位置
  • left是定位的属性

可见性

  • visibility:

    •             visibility: hidden; /*隐藏*/
       			/* 溢出策略 */
                  overflow:scroll;
      
  • div{
                width: 50px;
                height: 500px;
                overflow: hidden;
                display: inline-block;
                
            }
            div:hover{
                overflow:visible;
                width:885px;
            }
    
  • <div>
            <img src="../2022-8-22/morning/img/a.webp" alt="">
        </div>
        <div>
            <img src="../2022-8-22/morning/img/a.webp" alt="">
        </div>
        <div>
            <img src="../2022-8-22/morning/img/a.webp" alt="">
        </div>
        <div>
            <img src="../2022-8-22/morning/img/a.webp" alt="">
        </div>
        <div>
            <img src="../2022-8-22/morning/img/a.webp" alt="">
        </div>
    
  • image-20220823150500180

浮动

  • 清除浮动

    • <!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">
          <title>Document</title>
          <link rel="stylesheet" href="../../2022-8-22/cs.css">
          <style>
              .div1 {
                  width: 200px;
                  height: 200px;
                  background-color: aqua;
                  position:absolute;
                  z-index: -1;
              
              }
      
              .div3 {
                  width: 200px;
                  height: 200px;
                  background-color: yellow;
                  float: left;
                  z-index: 200;
      
              }
              li{
                  list-style: none;
                  float: left;
                  width: 150px;
                  height: 20px;
                  background-color: aquamarine;
                  margin-left: 20px;
              }
              ul{
                  background-color: pink;
                  /* float: left;  */
                  /* width: 100%; */
              }
              .as::after{
                  content: '';
                  height: 0;
                  line-height: 0;
                  display: block;
                  visibility: hidden;
                  clear: both;
              }
          </style>
      </head>
      
      <body>
          <ul class="as">
              <li>1111</li>
              <li>2222</li>
              <li>3333</li>
              <li>4444</li>
              <!-- <div style="clear: both;"></div> -->
          </ul>
      </body>
      
      </html>
      

动画

  • css3兼容性的问题

    • /*延迟*/
      div{
                  /* 针对于火狐浏览器 */
                  /* -moz-transform: ; */
                  /* 针对于Safari 和Google */
                  /* -webkit-transform: ; */
                  /* 针对于Opera */
                  /* -o-transform: ; */
                  
      
                  /* Transition -延迟转换*/
                  width: 100px;
                  height: 100px;
                  background-color: orange;
                  transition: width 1s  3s,height 3s ease-in,background-color ease-out 3s;
              }
              div:hover{
                  width: 500px;
                  height: 500px;
                  background-color: aqua;
              }
      
  • transition与animate的区别

    • transition只能通过固定的属性来开始与结束值
    • animate可以一帧一帧的去实现效果

练习

image-20220823113902141

        .size {
            width: 200px;
            height: 200px;
            border-top-right-radius: 65px;
            border-bottom-left-radius: 65px;
            background-color: green;
            position: relative;
            left: 100px;
            top: 100px;
        }

        .size1 {
            width: 200px;
            height: 200px;
            border-bottom-right-radius: 65px;
            border-top-left-radius: 65px;
            background-color: orange;
            position: relative;
            left: 100px;
            
        }

        .size2 {
            width: 200px;
            height: 200px;
            border-bottom-right-radius: 65px;
            border-top-left-radius: 65px;
            background-color: blue;
            position: relative;
            right: 0px;
            top: 100px;
        }

        .size3 {
            width: 200px;
            height: 200px;
            border-top-right-radius: 65px;
            border-bottom-left-radius: 65px;
            background-color: red;
        }

        .a {
            width: 300px;
            height: 300px;
            background: rgb(5, 230, 5);
            border-top-left-radius: 50px;
        }

        .b {
            width: 300px;
            height: 300px;
            background: rgb(12, 101, 235);
            border-top-right-radius: 50px;
        }

        .c {
            width: 300px;
            height: 300px;
            background: rgb(246, 136, 33);
            border-bottom-left-radius: 50px;
        }

        .d {
            width: 300px;
            height: 300px;
            background: rgb(238, 107, 107);
            border-bottom-right-radius: 50px;
        }
    <table border="0" cellspacing="0px">
        <tr>
            <td>
                <div class="a">
                    <div class="size back"></div>
                </div>

            </td>
            <td>
                <div class="b">
                    <div class="size2 back"></div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="c">
                    <div class="size1 back"></div>
                </div>
            </td>
            <td>
                <div class="d">
                    <div class="size3 back"></div>
                </div>

            </td>
        </tr>
    </table>

后端必须掌握

  • 选择器【十分重要】
  • css三大特征:层叠性,继承性,优先级
  • 盒子模型
  • 定位
  • 浮动,清除浮动(****)
  • 常见的属性——字体,背景,列表,边框等等
  • 元素的隐藏,元素内容的溢出,【overflow,fisplay,visibility】
  • 【开发中,推荐使用外部引入的方式】

标签:2022,23,第一组,height,width,background,200px,border,left
From: https://www.cnblogs.com/gycddd/p/16617394.html

相关文章

  • 2022-08-23 第二组刘禹彤 学习笔记
    打卡38天  ###学习内容CSS(续)CSS三大特性层叠性一个标签可以有多个CSS样式浏览器处理冲突的能力,如果一个属性通过两个相同的选择器设置到元素上,样式的层叠规则......
  • 2022年8-22到8-26
    8月22日DTOhttps://www.cnblogs.com/Gyoung/archive/2013/03/23/2977233.htmlDTODataTransferObject,应用于表现层和应用层之间的数据交互,是为了前端UI的需要,而不是领......
  • 2022飞天技术峰会:硬之城如何基于 SAE 打造数智化电子工业互联网平台
    全球数字化时代已经到来,数字经济正推动生产方式、生活方式和治理方式的深刻变化,成为重组全球要素资源,重塑经济结构,改变全球竞争格局的关键力量。云是连接现实与虚拟孪生世......
  • JAVA基础--案例课程--2022年8月23日
    第一节 买飞机票  packagecom.flowerDance.cases;importjava.util.Scanner;publicclassticketingSystem{publicstaticvoidmain(String[]args){......
  • spring cloud gateway rce(CVE-2022-22947)分析
    环境搭建https://github.com/spring-cloud/spring-cloud-gateway/releases/tag/v3.0.6漏洞分析该漏洞造成原因是因为配置可写+SPEL表达式的解析导致的SpEL表达式的触......
  • 记录---从0823开始
    ----规范-----------读书笔记:第一章整洁代码1,整洁代码力求集中,每个函数、每个类和每个模块都全神贯注于一件事。2,整洁代码简单直接,从不隐藏设计者的意图。3,整洁代码应当......
  • 暑假学习一 8.23日
    今日学习内容:1.安装VMware虚拟机,并且按照黑马程序员课程提示搭建了几个虚拟机,中途出现的问题是,所给的课程资料并没有给镜像文件,搜索镜像文件时,搜不到iso1908的文件,当天下......
  • 【2022-08-18】连岳摘抄
    23:59只要我们总能及时看到自己眼睛里的梁木,我们就会变得善良。                                ......
  • 2022-8-23 剑指offer-优先队列(堆)-每日一题-太难不写了
    剑指OfferII061.和最小的k个数对难度中等44收藏分享切换为英文接收动态反馈给定两个以升序排列的整数数组 nums1 和 nums2 , 以及一个整数 k 。定义......
  • Java中枚举配合switch语句用法-2022新项目
    一、业务场景项目开发中经常会遇到多条件判断的情况,如果判断条件少的话使用if/elseif/else还比较好处理,如果判断条件多的话,则在使用这种语句就不太合适。如果是自定......