js+css实现倒计时表单及倒计时效果代码
代码语言:html
所属分类:表单美化
代码描述:js+css实现倒计时表单及倒计时效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400&display=swap"); html { box-sizing: border-box; } body { margin: 0; min-height: 100vh; overflow-y: hidden; display: flex; align-items: center; font-family: "Roboto", sans-serif; position: relative; } /* Video Background */ .video-background { position: fixed; right: 0; bottom: 0; width: 100vw; height: 100%; } video { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .video-overlay { position: fixed; left: 0; top: 0; height: 100vh; width: 100vw; background-color: rgba(0, 0, 0, 0.1); } /* Container */ .container { min-width: 580px; min-height: 304px; color: black; margin: 0 auto; padding: 25px 50px; border-radius: 8px; z-index: 2; display: flex; justify-content: center; background-color: #f6f6f6; } .input-container { position: relative; top: 20px; } h1 { font-size: 22px; text-align: center; margin-top: 0; margin-bottom: 10px; } /* Form */ .form { width: 480px; } label { font-weight: bold; margin-left: 10px; } input { font-family: inherit; width: 95%; margin-bottom: 10px; padding: 10px; border: 1px solid #ccc; border-radius: 20px; background: #fff; outline: none; } /* Button */ button { width: 100%; height: 40px; border-radius: 20px; margin-top: 15px; border: none; text-transform: uppercase; background: #6a35fa; color: white; cursor: pointer; outline: none; } button:hover { filter: brightness(110%); } /* Countdown */ ul { margin-left: -45px; } li { display: inline-block; font-size: 1em; list-style-type: none; padding: 10px; text-transform: uppercase; } li span { display: block; font-size: 80px; text-align: center; } /* Complete */ .complete { position: relative; top: 60px; } .complete-title { animation: complete 4s infinite; } @keyframes complete { 0% { color: #d63200; } 25% { color: #f0d800; } 50% { color: #44d600; transform: scale(1.3); } 75% { color: #0044d6; } 100% { color: #d600b2; } } /* Media Query: Large Smartphone (Vertical) */ @media screen and (max-width: 600px) { .video-background { height: 100vh; width: 100vw; } video { object-fit: cover; margin-top: -1px; object-position: 70%; } .container { min-width: unset; width: 95vw; min-height: 245px; padding: 20px; margin: 10px; } .input-container { top: unset; } .countdown { position: relative; top: 10px; } .form { width: unset; } input { width: 93%; } h1 { font-size: 20px; } li { font-size: 15px; } li span { font-size: 40px; } } .ig { position: absolute; bottom: 20px; right: 20px; width: fit-content; padding: 4px 10px; border-radius: 100px; border: 1px solid #000; text-decoration: none; transition: all 0.4s ease; color: #000; } .ig:hover { background-color: #000; color: #fff; } </style> </head> <body> <!-- video background --> <!-- <video src="time.mp4" class="video-background" loop muted autoplay></video> <div class="video-overlay"></div> --> <!-- container --> <div class="container"> <!-- input --> <div class="input-container" id="input-container"> <h1>Create your custom countdown!</h1> <form action="" class="form" id="countdownForm"> <label for="title">Title</label> <input type="text" id="title" placeholder="What are you counting down for?" /> <label for="date-picker">Select a date</label> <input type="date" id="date-picker" /> <button class="submit">Submit</button> </form> </div> <!-- countdown --> <div class="countdown" id="countdown" hidden> <h1 class="countdown-title" id="countdown-title"></h1> <ul> <li><span></span>Days</li> <li><span></span>Hours</li> <li><span></span>Minutes</li> <li>&l.........完整代码请登录后点击上方下载按钮下载查看
网友评论0