html5 css3光晕

关于html5 css3实现光晕,首先我们想有个圆,这个圆向外发送圆环,如果是光晕,至少是2个圆环,不同的释放,圆环就是一个圆,只有border有颜色,其他的没有颜色,即background-color:none ,仅仅是border:1px yellow solid ,这样的圆环太死板,需要加个阴影box-shadow,既然是光晕,那么就需要有动画animation,需要一直动:infinite ,运行事件1.5秒,第二个圆环,延迟运行animation-delay:0.6,普通动画是只执行一次,@keyframes可以运行无限次 ,圆环scale(1) 到scale(8),transform

<!DOCTYPE html>
<html >

<head>
    <meta charset="UTF-8">
    <title>点扩散</title>
    <style>
        #circle
        {
            width:4px;
            height:4px;
            background-color:#ffffff;        
            border-radius:50%;
            border:6px solid blue;    
            position: relative;
            margin:100px;
        }
        #circle p,#circle span
        {
            position: absolute;
            width:4px;
            height:4px;
            border-radius:50%;
            
            box-shadow: 0px 0px 1px #009FD9;
            animation: halo 1.5s infinite;
            margin:0px;
            padding:0px;
        }
        
        #circle span
        {
            animation-delay:0.1s;
        }
        
        #circle #p1
        {
            animation-delay:0.2s;
        }
        
        
        #circle #span1
        {
            animation-delay:0.8s;
        }
        
        
        @keyframes halo
        {
            10% { transform:scale(1)}
            100% { transform:scale(8)}
        }

    </style>

</head>

<body>

    <div id="circle">
        <p></p>
        <span></span>
        <p id="p1"></p>
        <span id="span1"></span>
        
    </div>

</body>

</html>

 

 

-----下面是网上的,谢谢  https://blog.youkuaiyun.com/NicoleSmith/article/details/81098147---

<!DOCTYPE html>

<html lang="en">

 

<head>

<meta charset="UTF-8">

<title>点扩散</title>

<style>

 

  .content div

  {

  width:4px;

  height:4px;

  background-color:red;

  border: 6px #009FD9 solid;

border-radius:50%;

  margin:10px;

  position: relative;

 

 

  }

 

  .content p,.content span

  {

  position: absolute;//有个问题,就是必须有这个,否则animation-delay: 0.4s不管用

  width:4px;

  height:4px;

 

  border-radius:50%;

  box-shadow: 0px 0px 1px #009FD9;

  animation: myfirst 1.5s  infinite;

margin: 0px;

  }

  .content  span{

animation-delay: 0.4s;

}

 

.content .one{position: absolute;left:600px; top:100px;}

.content .ten{background: #A2A9B4;position: absolute;left:300px; top:350px;}

 

 

  @keyframes myfirst

  {

  10%  {transform :scale(1);}

  100% {transform :scale(8);}

  }

</style>

<script src="http://code.jquery.com/jquery-latest.js"></script>

<script type="text/javascript">

 

function change(){

 

// var myContent = document.getElementById("content");

// console.log(myContent);

$("#content div").css("border"," 6px #00FF7F solid");

$("#content p").css("box-shadow"," 0px 0px 1px #00FF7F");

$("#content span").css("box-shadow"," 0px 0px 1px #00FF7F");

 

}

 

</script>

</head>

 

<body>

 

<div class="content" id="content">

<div class="one"><p></p><span></span></div>

<div class="ten"><p></p><span></span></div>

<input type="button" name="改变样式" value="改变样式" onClick="change()" />

</div>

 

</body>

 

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值