DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> WEB網站前端 >> WEB前端代碼
視覺精美的使用者登入頁 HTML 範本(含切圖化介面原始碼)
編輯:WEB前端代碼     

效果預覽:https:///keleyi/phtml/divcss/21.htm

HoverTree 這個開源專案在完成分層架構之後,接著要動工的是管理員後台,而後台的第一道門就是登入頁。因此先把登入介面的 HTML 與 CSS 骨架整理出來,後面接上任何後端語言都能直接沿用。

版面設計思路

整個登入框以一個 468×468 的固定尺寸容器 .lg 為基礎,背景使用 login_bg.png,再靠 margin:100px auto 讓它水平置中並與頁面頂端拉開距離。容器內部再切成三塊:上方留白區 .lg_top、中部的輸入區 .lg_main,以及底部的按鈕區 .lg_foot。

輸入框本身就當成圖片的載體——使用者名稱欄用 user.png、密碼欄用 password.png 當背景圖,透過 padding-left 把文字往右推開,看起來就像圖示內建在欄位裡;登入按鈕則整顆做成 enter.png 的樣子。這種做法在當年很常見,優點是視覺一致性高,缺點是圖片一多維護成本也跟著上升。

HTML 原始碼

<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>好看的用戶登錄html模板-</title><base target="_blank" />
<style>
*{
 padding:0px;
 margin:0px;
 }
 a{color:White}
body{
 font-family:Arial, Helvetica, sans-serif;
 background:url(https:///keleyi/phtml/divcss/21/images/grass.jpg) no-repeat center;
 font-size:13px;
 }
img{
 border:0;
 }
.lg{width:468px; height:468px; margin:100px auto; background:url(https:///keleyi/phtml/divcss/21/images/login_bg.png) no-repeat;}
.lg_top{ height:200px; width:468px;}
.lg_main{width:400px; height:180px; margin:0 25px;}
.lg_m_1{
 width:290px;
 height:100px;
 padding:60px 55px 20px 55px;
}
.ur{
 height:37px;
 border:0;
 color:#666;
 width:236px;
 margin:4px 28px;
 background:url(https:///keleyi/phtml/divcss/21/images/user.png) no-repeat;
 padding-left:10px;
 font-size:16pt;
 font-family:Arial, Helvetica, sans-serif;
}
.pw{
 height:37px;
 border:0;
 color:#666;
 width:236px;
 margin:4px 28px;
 background:url(https:///keleyi/phtml/divcss/21/images/password.png) no-repeat;
 padding-left:10px;
 font-size:16pt;
 font-family:Arial, Helvetica, sans-serif;
}
.bn{width:330px; height:72px; background:url(https:///keleyi/phtml/divcss/21/images/enter.png) no-repeat; border:0; display:block; font-size:18px; color:#FFF; font-family:Arial, Helvetica, sans-serif; font-weight:bolder;}
.lg_foot{
 height:80px;
 width:330px;
 padding: 6px 68px 0 68px;
}
</style>
</head>

<body class="b">
<div class="lg">
<form action="#" method="POST">
 <div class="lg_top"></div>
 <div class="lg_main">
 <div class="lg_m_1">

 <input name="username" value="hovertree" class="ur" />
 <input name="password" type="password" value="" class="pw" />

 </div>
 </div>
 <div class="lg_foot">
 <input type="button" value="點這裡登錄" class="bn" /></div>
</form>
</div>
<div style="text-align:center;">
<p><a href="https:///">首頁</a> <a href="https:///keleyi/phtml/">特效庫</a> <a href="https:///a/bjae/6asac24d.htm">原文</a></p>
</div>
</body>
</html>

點擊這裡下載

改寫建議

若要在專案裡沿用這份骨架,記得把 action="#" 換成真正的登入端點,並把登入按鈕從 type="button" 改成 type="submit",才能觸發表單提交;同時建議補上 <label> 與 placeholder,讓沒有 CSS 或重度依賴螢幕閱讀器的使用者也能理解每個欄位的用途。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved