如何使用 HTML 和 Bootstrap 創建即將推出的頁面
已發表: 2020-03-02如果您熟悉網站和應用程序,您可能知道即將推出的頁面。 當您的網站尚未準備好發佈時,它會為您的網站創造品牌價值。 即將推出的頁面還有助於讓用戶了解您的存在,並讓他們確切知道您何時上線。 使用超棒的倒數計時器,您可以在您的網站上創建令人驚嘆的即將推出或正在建設中的模板。
為什麼需要即將推出的頁面?
- 您可以使用即將推出頁面上的訂閱表格將訪問者轉換為訂閱者。
- 您可以推廣您的社交鏈接
- 您可以通過選擇特定的關鍵字來提高網站排名
即將推出的頁面會在您的網站上線時通知人們,您將有更多時間專注於您的網站發布。
使用 HTML CSS 和 JavaScript 創建即將推出的頁面

創建一個 Html 文件 例如:(commingsoon.html)
<div class="bgimg"> <div class="topleft"> <p>Logo</p> </div> <div class="middle"> <h1>COMING SOON</h1> <hr> <p>35 days</p> </div> <div class="bottomleft"> <p>Some text</p> </div>
添加 CSS
注意:如果您想在相同的 HTML 文件中使用 CSS,則必須在 <Style> 標記中使用 CSS 代碼,或者如果您使用外部 css 文件,則需要使用 .css 擴展名命名,例如comingsoonpages.css
<style> /* code goes here */ </style>
/* Set height to 100% for body and html to enable the background image to cover the whole page: */ body, html { height: 100% } .bgimg { /* Background image */ background-image: url('/w3images/forestbridge.jpg'); /* Full-screen */ height: 100%; /* Center the background image */ background-position: center; /* Scale and zoom in the image */ background-size: cover; /* Add position: relative to enable absolutely positioned elements inside the image (place text) */ position: relative; /* Add a white text color to all elements inside the .bgimg container */ color: white; /* Add a font */ font-family: "Courier New", Courier, monospace; /* Set the font-size to 25 pixels */ font-size: 25px; } /* Position text in the top-left corner */ .topleft { position: absolute; top: 0; left: 16px; } /* Position text in the bottom-left corner */ .bottomleft { position: absolute; bottom: 0; left: 16px; } /* Position text in the middle */ .middle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; } /* Style the <hr> element */ hr { margin: auto; width: 40%; }
添加 JavaScript
注意:如果你想在下面的 Javascript 中使用相同的 HTML 文件,那麼你必須在 <script> 標記中使用 Javascript 代碼,或者如果你正在使用外部 JavaScript 文件,那麼你需要使用 .js 擴展名來命名,比如comingsoonpages.js
<script> // code goes here </script>
// Set the date we're counting down to var countDownDate = new Date("Jan 5, 2021 15:37:25").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Get the distance between now an the count down date var distance = countDownDate - now; // Calculations of time for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Display the result in an element (demo) with document.getElementById("demo").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is finished, show some text if (distance < 0) { clearInterval(x); document.getElementById("demo").innerHTML = "EXPIRED"; } }, 1000);
我們感謝 w3schools 為即將推出的頁面提供了一個很棒的教程,您可以查看是否要在W3schools上現場測試本教程

準備使用預製的 HTML 模板
如果您不想創建自己的模板或者您沒有任何編碼技能,那麼您會喜歡選擇準備使用 HTML 模板。
這裡有一些令人驚嘆且完全免費的 HTML 模板,用於即將推出的頁面
1. Soon – 免費的 HTML5 Bootstrap Coming Soon 模板

Soon 是基於 bootstrap 的 Coming Soon 頁面的免費模板。 在發布之前,此模板可以很好地查看您的網站。 它有一個倒數計時器,您可以在其中指定通知訪問者您的網站的啟動日期,並附帶一個訂閱表格,您可以收集訪問者的電子郵件以通知他們。
信息| 演示
2. 即將推出的 3D 視差模板

Imminent 是一個 3D Parallax bootstrap 免費即將推出的模板,使用 HTML5 和 CSS3 創建。 外觀精美的極簡創意設計,您將找不到任何帶有視差 3D 效果的免費即將推出的模板! 外觀精美的模板,但它是免費提供的!
信息| 演示
3. Colorlib V05 即將推出的模板

第五版模板被設計為您可能在電子商務網站模板中看到的閃購類型。 在頁面頂部,您會看到倒計時。 此模板使用漸變作為背景。 您可以將其用作應用啟動頁面、現代應用登錄頁面、商業或商業網站。 您還可以選擇訂閱表格。 訂閱表單按鈕具有懸停效果。 表單字段還支持字段驗證。
信息| 演示| WordPress 版本
如果您使用的是 WordPress,那麼您可以使用即將推出的 WordPress 插件和維護模式。
即將推出頁面和正在建設和維護模式由 SeedProd 設計
優點、特點和選項:
- 適用於任何 WordPress 主題
- 響應式
- 自定義外觀
- 輕鬆添加自定義 CSS 和 HTML
- 使用 HTML5 和 CSS3
- 翻譯就緒,支持 i18n
- 多站點支持
- BuddyPress 支持
- 使用 WordPress 最佳實踐
即將推出的免費 WordPress 插件
4. 最小的即將推出和維護模式 - 即將推出頁面

Minimal Coming Soon 插件最小但優雅,功能強大,適用於任何 WordPress 主題。 您將完全控製網站的前端,並且可以根據需要修改模板的幾乎所有方面。 輕鬆連接 MailChimp 並收集訪問者的電子郵件。 一個完美的即將推出的頁面在幾分鐘內完成!
信息| 演示
希望您喜歡我們的帖子,請在評論部分分享您的想法和反饋。 謝謝!