6.背景属性

  • background-color 背景颜色
  • background-image 背景图片
background-imageurl("1.png");
  • 背景平铺background-repeat:

    repeat默认平铺 |no-repeat不平铺 |repeat-x水平方向平铺,垂直不平铺 |repeat-y 垂直方向平铺

  • background-position
    left | right |center |top |bottom 背景定位
    特点:
    (1)方位值只写一个时,另一个默认居中
    background-position:left; (方向在左面,垂直方向居中)
    (2)写2个方位值得时候,左右和垂直顺序没有要求。
    background-position:right buttom;
    (3)只写一个center时,图片在中间。
    background-position:center;
    (4)当写两个具体值时,第一个代表水平方向,第二个代表垂直方向。(只写一个数值时,则这个数值代表水平方向,垂直方向居中。)
    background-position:20px,30px;
  • 背景是否滚动:background-attachment: scroll | fixed;

scroll图片定位从元素的定位出发(默认)。
fixed图片定位从浏览器定位出发。

<head>
    <style type="text/css">
        .box{
            width:1400px;
            height:1500px;
            background-image:url("1.png");
            background-repeat:no-repeat;
            background-position:bottom right;
            background;fixed;
        }
    </style>
</head>
<body>
    <div class="box">df<div>
</body>
  • 背景属性连写:

background:red url("1.png") no-repeat bottom;
特点:连写时没有顺序要求,url为必写项,位置,重复等才会生效。

※清除列表项前面的小标

li{
    list-style:none ;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值