background & background-image & border-image

本文深入探讨了CSS中background与border-image属性的使用方法,包括如何设置背景图片的重复、位置与大小,以及如何利用border-image创建复杂的边框效果。同时,文章提供了多个实例,展示了linear-gradient和background-size的cover属性的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

background & background-image & border-image

https://developer.mozilla.org/en-US/docs/Web/CSS/background

https://developer.mozilla.org/en-US/docs/Web/CSS/border-image


https://developer.mozilla.org/zh-CN/docs/Web/CSS/background

https://developer.mozilla.org/zh-CN/docs/Web/CSS/border-image

background & radius border

background color & view bug

https://codepen.io/xgqfrms/full/JQeqXQ

740516-20190709165430993-1947613208.png

linear-gradient

https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient

https://codepen.io/xgqfrms/pen/WqEBLB

740516-20190626145047133-1079050266.png

https://codepen.io/xgqfrms/pen/bPrymz

740516-20190626144112980-835810788.png


background-size

cover

https://developer.mozilla.org/zh-CN/docs/Web/CSS/background-size


.circle {
    position: absolute;
    width: 1.76rem;
    height: 1.56rem;
    line-height: 1.56rem;
    /* background: url("../../images/guide/hexagon.png") cover no-repeat center center ; */
    background: url("../../images/guide/hexagon.png") no-repeat center center ;
    background-size: cover;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    font-size: 0.28rem;
    /* font-size: 0.16rem; */
    color: #fff;
}

/* iphone 6/7/8 */
/* width: 375px & height: 667px */
@media (min-width: 375px) and (max-width: 375px) and (orientation: portrait) {
    .circle {
        position: absolute;
        width: 1.76rem;
        height: 1.76rem;
        line-height: 1.56rem;
        background: url("../../images/guide/hexagon.png") no-repeat center center;
        text-align: center;
        vertical-align: middle;
        cursor: pointer;
        font-size: 0.16rem;
        color: #fff;
    }
    .menu-text31 {
        transform: translateX(0.55rem) translateY(-0.15rem);
    }
    .menu-text32 {
        transform: translateX(-0.35rem) translateY(0.3rem);
    }
}

/* iphone 6/7/8 plus*/
/* width: 414px & height: 736px */
@media (min-width: 414px) and (max-width: 414px) and (orientation: portrait) {
    .circle {
        position: absolute;
        width: 1.76rem;
        height: 1.56rem;
        line-height: 1.56rem;
        background: url("../../images/guide/hexagon.png") no-repeat center center;
        text-align: center;
        vertical-align: middle;
        cursor: pointer;
        font-size: 0.16rem;
        color: #fff;
    }
    .menu-text31{
        transform: translateX(0.45rem) translateY(-0.15rem);
    }
    .menu-text32{
        transform: translateX(-0.35rem) translateY(0.2rem);
    }
}

转载于:https://www.cnblogs.com/xgqfrms/p/11089728.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值