css
主页 > 网页 > css >

css实现发光文字及一点点js特效的方法

2019-04-24 | 秩名 | 点击:
本篇文章介绍css实现发光文字及一点点js特效的方法。

实现思路:

通过css中的text-shadow来实现文字的发光效果

效果图:



代码如下:

</head>
  <style>
    body{
      background-color:#000;
    }
    .textArea{
      font-size:100px;
      color:#fff;
      text-shadow:0 0 5px #e0ea33,
           0 0 15px #e0ea33,
           0 0 25px #e0ea33;
      margin-top:200px;
      text-align:center;
    }
  </style>
<body>
  <p class="textArea">帅</p><!--此处是文字内容-->
 </body>
<script>
  var text=document.querySelector('.textArea');//获取到我们的P标签
   //在鼠标指针进入到P标签上时触发
   text.onmouseenter=function(){
  text.innerHTML='我是你爸爸';//设置P标签之间的 HTML
  };
  //在鼠标指针离开P标签上时触发
   text.onmouseleave=function(){
  text.innerHTML='帅';//设置P标签之间的 HTML
  };
</script>

原文链接:https://www.jb51.net/css/669292.html
相关文章
最新更新