滑鼠懸浮文字實現霓虹燈效果程式碼例項

antzone發表於2017-03-06

分享一段程式碼例項,它實現了滑鼠懸浮文字霓虹燈效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
body{
  background-color:#000;
}
.menu{
  display:inline-block;
  text-align:center;
  margin:300px 200px 0px 270px;
}
.neon, .neon:hover .broken{
  color:transparent;
  font-size:50px;
  font-style:italic;
  text-decoration:none;
  text-shadow:
    0 0 0.32px hsla(70, 100%, 60%, 1), 
    0.64px 0.32px 0.8px hsla(80, 100%, 70%, .8),
    .03em .03em .1em #f00,
    .03em .03em .1em #f00,
    -.03em .03em .1em #f00,
    -.03em -.03em .1em #f00,
    .03em .03em .8em #f00,
    .03em -.03em .8em #f00,
    -.03em .03em .8em #f00,
    -.03em -.03em .8em #f00;
}  
.broken {
  text-shadow:
    0 0 .02em hsla(30, 100%, 60%, .6),
    .04em .02em .05em hsla(30, 100%, 70%, .3),
    .03em .03em .1em hsla(0, 100%, 50%, .3),
    .03em .03em .1em hsla(0, 100%, 50%, .3),
    -.03em .03em .1em hsla(0, 100%, 50%, .3),
    -.03em -.03em .1em hsla(0, 100%, 50%, .3);
}
</style>
</head>
<body>
<ul class="menu">
  <li>
    <a href="#" class="neon">
      <span class="broken">螞蟻部落</span>
    </a>
  </li>
</ul>
</body>
</html>

相關文章