css实现探照灯照射时钟文字时间效果

代码语言:html

所属分类:布局界面

代码描述:css实现探照灯照射时钟文字时间效果

代码标签: 照射 时钟 文字 时间 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: black;
    color: #666;
    font-family: sans-serif;
    font-size: 16px;
    overscroll-behavior: none;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
}

#container {
    width: 90vw;
    height: 90vh;
}

#title {
    text-align: center;
    width: 100%;
    padding: 10px 0 10px 0;
}

#box {
    position: relative;
    width: 100%;
    height: 100%;
    background: #666;
    overflow: hidden;
    /*cursor: none;*/
    border: 1px solid #333;
    
    -webkit-tap-highlight-color: rgba(0,0,0,0);
	-webkit-user-select: none;
}

.shadow__wall {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
}

#shadow__text {
    position: absolute;
    width: 100%;
    margin: 0;
    color: #999;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 5rem;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}

.shadow__box {
    position: absolute;
    background: #999;
    top: 4.5rem;
    height: 50vh;
}

#shadow__box--back {
    left: -5%;
    width: 110%;
}

#shadow__box--front {
    left: 0;
    width: 100%;
}

#shadow__spot {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: -webkit-gradient(radial, center center, 0, center center, 250, from(rgba(0,0,0,0)), to(rgba(0,0,0,1)));
}
</style>

</head>
<body translate="no">
<div id="container">
<div id="title">Move your cursor over the box to cast a shadow with the spotlight.</div>
<div id="box">
<div class="shadow__wall">
<div class="shadow__box" id="shadow__box--back"></div>
<p id="shadow__text">12:34:56</p>
<div class="shadow__box" id="shadow__box--front"></div>
</div>
<div id="shadow__spot"></div>
</div>
</div>

<scri.........完整代码请登录后点击上方下载按钮下载查看

网友评论0