H5_0013:CSS特色样式集

本文介绍如何使用CSS实现div元素的横竖居中显示,通过设置宽度百分比、绝对定位和transform属性。此外,还讲解了如何应用transform动画特效,如缩放动画,并通过JavaScript调用实现动态效果。

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

1,div横竖居中显示

宽度用百分比,高度根据实际情况而定,div的最大宽高都做了限制

".start-wrap {",
" width:34.5%;",
" position: absolute;",
" left: 50%;",
" transform: translate(-50%,-50%);",
" top: 50%;",
" max-width: 143px;",
" max-height: 52px;",
"}",

 

2,transform动画特效

例如:

.timepoint{
width:7.25%;
height:88.24%;
position:absolute;
right: 30%;
top: -40%;
background-image: url("$15885866%");
background-size: contain;
background-repeat: no-repeat;
background-position: center;
transition: all 0.5s;
transform: scale(0);
transition-delay: 1s;
}

 

1秒的时间比例从0到1。

js调用:

div.timepoint.transform = "scale(1)",
 
 
 
 
        // js给元素增减css样式
        // $(".stp4button").addClass("animation"),
        // $(".stp4button").removeClass("animation"),

 

 

z-index 为 -1 是隐藏

    $("#mian_nor").css("z-index", "-1"),
    $("#yi_nor").css("z-index", "1"))

 

转载于:https://www.cnblogs.com/eliteboy/p/10862403.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值