使用CSS对页面加载的淡入效果

本文翻译自:Using CSS for fade-in effect on page load

Can CSS Transitions be used to allow a text paragraph to fade-in on page load? CSS Transitions可用于允许文本段落在页面加载时淡入吗?

I really like how it looks on http://dotmailapp.com/ and would love to use a similar effect using CSS. 我真的很喜欢它在http://dotmailapp.com/上的样子,并且喜欢使用CSS使用类似的效果。

Note: The domain has since been purchased and no longer has the effect mentioned. 注意:该域名已被购买,不再具有上述效果。 An archived copy can be viewed on the Wayback Machine . 可以在Wayback Machine上查看存档副本。

Illustration 插图

Having this markup: 有这个标记:

<div id="test">    
    <p>​This is a test</p>
</div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

With the following CSS rule: 使用以下CSS规则:

#test p {
    opacity: 0;
    margin-top: 25px;
    font-size: 21px;
    text-align: center;
    -webkit-transition: opacity 2s ease-in;
    -moz-transition: opacity 2s ease-in;
    -o-transition: opacity 2s ease-in;
    -ms-transition: opacity 2s ease-in;
    transition: opacity 2s ease-in;
}​

How can the transition be triggered on load? 如何在加载时触发转换?


#1楼

参考:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值