JavaScript實現代碼雨效果
更新時間:2022年01月13日 10:19:26 作者:HAI6545
這篇文章主要為大家詳細介紹了JavaScript實現代碼雨效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了JavaScript實現代碼雨效果的具體代碼,供大家參考,具體內容如下
<!DOCTYPE html>
<html lang="en">
?
<head>
? <meta charset="UTF-8">
? <meta http-equiv="X-UA-Compatible" content="IE=edge">
? <meta name="viewport" content="width=device-width, initial-scale=1.0">
? <title>代碼雨demo</title>
</head>
<style>
? * {
? ? padding: 0px;
? ? margin: 0px;
? }
?
? body,
? html {
? ? width: 100%;
? ? height: 100%;
? }
?
? #libao {
? ? width: fit-content;
? ? height: 100%;
? ? display: flex;
? ? font-size: 10px;
? ? background: #000;
? ? word-wrap: break-word;
? ? word-break: break-all;
? ? overflow: hidden;
? }
?
? span {
? ? min-width: 15px;
? ? /* 柵欄格最小寬度 */
? ? font-size: 10px;
? ? color: #58bc5b;
? ? position: relative;
? }
?
? p {
? ? width: 100%;
? ? position: absolute;
? ? text-align: center;
? }
?
? .color6 {
? ? color: #58bc5b;
? }
?
? .color5 {
? ? color: #58bc5bd6;
? }
?
? .color4 {
? ? color: #58bc5ba8;
? }
?
? .color3 {
? ? color: #58bc5b60;
? }
?
? .color2 {
? ? color: #58bc5b28;
? }
?
? .color1 {
? ? color: #58bc5b10;
? }
</style>
?
<body>
? <div id="libao">
? </div>
??
</body>
?
</html>效果:

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
深入理解JavaScript系列(16) 閉包(Closures)
本章我們將介紹在JavaScript里大家經常來討論的話題 —— 閉包(closure)。閉包其實大家都已經談爛了。盡管如此,這里還是要試著從理論角度來討論下閉包,看看ECMAScript中的閉包內部究竟是如何工作的2012-04-04
設為首頁加入收藏兼容360/火狐/谷歌/IE等主流瀏覽器的代碼
不用找了我試過好多次ie、火狐、谷歌瀏覽器此代碼都是不可逆兼容,想把這個問題完全解決,方法就是像其他主流網站一樣,下面是我的簡單解決方案2013-03-03

