首页 > 其他分享 >新人学习笔记之(CSS背景和列表)

新人学习笔记之(CSS背景和列表)

时间:2024-03-22 10:32:36浏览次数:13  
标签:style repeat 新人 image list none 列表 background CSS

一、CSS背景
        1.background-color

                1)background-color:颜色 ltransparent(black)颜色值(颜色名|rgb|十六进制)背景区包括内容 内边距,边框,不包括外边距

.box1{
    background-color: red ;
}
        2.background-image 

                1)背景图片 background-image:urlnone,元素的背景占据了元素的全部尺寸 包括内边距和边框 但不包含外边距 默认在水平垂直方向重复no-repeat 不重复

.box2{
            background-image: url(../img/使用qq登录.png);
            
        }

                        (1)在周定宽高的div里显示可用css性obiect-fit的几个属性:fi(不保持纵横比缩放图片,使图片完全适应)

                        (2)contain(保持纵横比缩放图片,使图片的长边能完全显示出来)

                        (3)cover(保持纵横比缩放图片,只保证图片的短边能完全显示出来)

                        (4)none(保持图片宽高不变)

                        (5)scale-down(当图片实际宽高小于所设置的图片宽高时,显示效果与none一致;否则,显示效果与contain一致        

        3.background-repeat

                1)设置元素图片的重复方式:repeatlno-repeat | repeat-xlrepeat-y 

.box1{
    /* 背景平铺 repeat-x横着平铺  repeat-y竖着平铺 no-repeat不平铺*/
            background-repeat: no-repeat;
}
        4.background-attachment

                1)设置元素图片的显示方式,scrol:默认值 背景图片随滚动条滚蛋, fixed:当页面其余部分滚动 背景图片不会滚动

.box1{
    
            /* attachment fixed背景图像固定  */
            background-attachment: fixed;
}
        5.background-position

                1)长度值(x,y)百分比(x%,y%) top,left,bottom, right,center

.box1{
            /* position背景图片位置top最上边 center中间 left左边 bottom最下面 right右边 */
            background-position: left center;
}
二、CSS列表
        1.list-style-type

                1)设置列表项的标记样式类型 关键字|none

                        (1)有序列表 none:无标记, decimal:从]开始的整数,lower-roman 小写罗马数字 upper-roman大写罗马数字 lower alpha 小写英文字母upper-alpha大写英文字母

ol li {
            list-style-type: lower-roman;
        }
        /* 有序列表 none:无标记, 
        decimal:从]开始的整数,
        lower-roman 小写罗马数字 
        upper-roman大写罗马数字 
        lower alpha 小写英文字母
        upper-alpha大写英文字母 */

                        (2)无序列表 none :无标记 disc:实心圆点,circle 空心圆点 square实心方块

 ul li {
            list-style-type: square;
        }
        /* 无序列表 none :无标记 
        disc:实心圆点,circle 
        空心圆点 square实心方块 */
        2.list-style-image

                1)设置图片设置列表项的标记 urlnone

ul li {
            list-style-image: url(../img/demon.jpg);
        }
        3.list-style-position

                1)设置列表项标记的位置 inside:列表项目标记放在在文本以内 环绕文字根据标记对齐 ,outside默认值 列表项目标放在在文本以外 且环绕文本不跟标记对齐 

ul li {
            list-style-position: inside;
        }
        4.list-style

                1)list-style:list-style-type ,list-style-position,list-style-image 顺序不固定 image会覆盖type

ul li {
            list-style: square inside url(../img/demon.jpg)  ;
        }
三、整体思维导图 

标签:style,repeat,新人,image,list,none,列表,background,CSS
From: https://blog.csdn.net/2401_83311390/article/details/136932252

相关文章

  • CSS 基本选择器
    1.通配选择器作用:可以选中所有的html元素,对于清除样式有帮助*{属性名:属性值}2.元素选择器元素名{属性名:属性值}3.类选择器根据class来进行分类,类选择器需要用,使用频率很高.class值{属性名:属性值}ps:多个class需要用空格连接写在一起4.ID选择器针对单个元素......
  • 文章分类列表(2024-3-21)
    //CategoryCOntroller@GetMappingpublicResult<List<Category>>list(){List<Category>cs=categoryService.list();returnResult.success(cs);}//ServiceList<Category>list();//ServiceImpl@Override......
  • Pytorch神经网络-元组/列表如何喂到神经网络中
    ......
  • 新人学习笔记之(盒子模型)
    一、盒子模型属性    1.width属性        (1)宽度:width:长度值|百分比|auto,最大宽度:max-width最小宽度:min-width.box1{width:300px;}.box2{min-width:1200px;}        2.height属性......
  • css背景样式
    background-image:url(../a.jpg);设置背景图片urlbackground-repeat设置显示方式repeat-x水平方向平铺repeat-y垂直方向平铺repeat:水平和垂直方向平铺round:自动缩放铺满整个容器space:背景等比例缩放铺满整个背景,可能会有空缺background-position设置背景的显示位置,......
  • CSS属性
    目录内部样式使用style标签把CSS嵌入到HTML中外部样式创建一个单独CSS文件(.css)通过HTML中的link标签,把CSS文件引过来内联样式直接在元素里面使用style属性把对应的CSS内容写进来选择器标签选择器直接对div进行操作类选择器给特定div命名再操作id选择器后代选择......
  • css字体样式
    font-family字体i类型font-size字体大小color字体颜色font-weight字体粗细font-style字体倾斜效果normalitalicobliquetext-decoration定义修实现可以定义下划线underline上划线overline删除线等样式line-throughfont-variant定义字体的变体取值normalsmall......
  • CSS问题精粹1
    1.关于消除<li>列表前的符号我相信很多人在初学CSS时会遇到该问题,无论是创作导航,还是列表,前面都会有个黑点点或其它符号。解决该问题其实很简单采用list-style-type:none或list-style:none直接解决如果你想更换前面的黑点点,换成其他符号或图片图标请看下面------>>>>>>......
  • 收藏一个不错的cssscript特效网站
    css水波浪效果demohttps://www.cssscript.com/demo/animated-waves-svg/  waves-animation/demohttps://www.cssscript.com/waves-animation/ ......
  • css样式
    样式的引入方法内部样式点击查看代码<head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>Document</title><styletype="text/css&quo......