解玲安-20201028

一、选择器
css3.0:层叠样式表(修饰网页)
            选择器(镜子):精确的选中要修饰的目标
            常用的选择器:可以共用
            6.通用选择器:可以修饰任何标签,优先级最低【只用一次】
               *{
              margin: 0;/*外边距*/
              padding: 0;/*内边距*/
              border: 0;/*边框*/
                  }
            1.类选择器:class关键字="box(名字随便起)" 类选择器的优先级高于标签选择器
                 .box{
    width: 300px;
    height: 200px;/*px:单位 像素*/
    background-color: red;
                 }
            2.标签选择器:里面不填,只在css里设置即可。若想两个h1不同,则要用类选择器
                h1{
    width: 300px;
    height: 200px;/*px:单位 像素*/
    background-color: #11aabb;
                 }
            3.ad选择器:的优先级高于类选择器
            <div class="box" id="box"></div>可以解析,但不允许
            <p class="box" id="box"></p>
                 #box{
    width: 400px;
    height: 200px;/*px:单位 像素*/
    background-color: #123;
                 }
            4.后代选择器:
                 .box ul li{
    color: green;
                 }
            5.伪类选择器:鼠标悬停状态【:hover】
                 a:hover{
    text-decoration: none;
                 }  
二、修饰字体和文本常用样式
                /*修饰字体*/
    color: red;/*修饰字体颜色*/
    font-size: 30px;/*字体大小*/
    font-family: "宋体";/*字体类型*/
    font-style: italic;/*字体样式*/
    font-weight: bold;/*字体加粗*/
    letter-spacing: 5px;/*字间距*/
    
    /*修饰文本*/
    text-align: center;/*对齐方式*/
    line-height:300px ;/*行高*/
    text-decoration: underline;/*文本划线*/
    text-shadow: 2px/*(水平距离)*/ 2px/*(垂直阴影距离)*/ 3px/*(模糊距离)*/ yellow;/*字体阴影*/
    text-indent: 2em;/*首行缩进*/
三、修饰网站的常用样式
                background-color: red;/*背景颜色*/
    background-image:url(../img/psb (6).jpg) ;/*背景图片*/
    background-size: 300px 300px;/*背景图片大小 宽(空格)高    cover不设宽高,用cover时等比例缩放*/
    background-repeat: no-repeat;
    /*背景图片平铺(没有平铺,只有一部分有图片) no-repeat不平铺  “repeat-x”沿x轴平铺*/
    background-attachment: fixed;/*内容滚动背景不动*/
    background-position: -100px 0px;/*背景图片移动    x轴y轴*/
    opacity: 0.2;/*透明度取值0到1*/
四、color: rgba(255,0,0,0.3(0-1透明度)) ;#FF0000
       或background-color: red;
       background-color: transparent;/*背景全透明*/

学习心得:
今天的学习内容感觉比较多,尤其是选择器,感觉自己比较模糊,需要多做练习,除了选择器之外的其他内容挺容易理解的。

标签

评论


© 2021 成都云创动力科技有限公司 蜀ICP备20006351号-1