|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
1 _: W. H* O% I7 E# T
4 y! F8 l! C% _6 M1 ` ~! R5 b
2 {+ w& E) R7 _4 M7 i7 q4 l登录代码:
; x* K+ P4 [, Y, u- Z6 L/ V* |1 d" w9 F9 ]: Z' ~- G
[mw_shl_code=html,true]<html lang="en">
3 l8 y9 v7 n/ i! M' L
+ ?: j5 K" D6 i+ Y<head>* ~- ?. }' Z K
<meta charset="UTF-8">
0 Q% Z- D/ n" E4 W+ o <meta name="viewport" content="width=device-width, initial-scale=1.0">( n5 k9 u! X, P' g7 q
<meta http-equiv="X-UA-Compatible" content="ie=edge">) R: L4 @( t% L! O( o
<title>This is a login form</title>
+ O2 b7 ]5 E5 i! s5 j& i1 L; V! g3 _$ H" e3 }
<style>
4 q6 y7 Q7 j% o7 N' _3 [1 m .modal {: j9 T K- {1 \/ A! Y) O4 J& l$ y
display: none;- y2 E, r+ _$ u: k9 j
width: 100%;
8 v$ \( S7 q/ r9 V height: 100%;
8 I" o% {& x* D8 b' I4 \5 w4 r position: fixed;2 G S+ U& j0 k* y; J* D0 B
overflow: auto;9 z2 @5 R1 E1 L) T* T) w
z-index: 1;: }' |1 ]( J, D, M1 ]! L- Q! j
left: 0;
0 D3 [1 O- F. w5 t: ` top: 0;+ D' o0 P7 K1 o6 d, `! c; s$ T% h! c3 n
background-color: rgb(0, 0, 0);' p$ y" G x$ i! x1 F
/* Fallback color */
5 G5 t( x$ a/ B' G& x5 E3 q+ H background-color: rgba(0, 0, 0, 0.4);' m. X: D; C7 S& ^+ A" a
/* Black w/ opacity */
5 ?4 e$ a' _6 A3 a c' A padding-top: 60px;
" \* d+ E) o" m# T
& l9 X$ p' \# b! O9 [ }
1 M6 G( l0 \( h7 J# I) Y- q8 Q2 z5 ^$ z' b1 j
.modal-content {( W5 z+ v+ C; p, g6 C
width: 60%;0 Y( V% |- W! Z5 t+ `4 ]
background-color: #fefefe;. z/ z& h0 E8 }
margin: 5% auto 15% auto;1 X* h" Y) J3 z0 ]( T/ \
border: 1px solid #888;
2 r' e) O/ e3 c& O5 D2 A# q5 S# p- k2 @
}
M6 n! {# N c* D( M; W5 o% X) Y! ~% h
/* The Close Button (x) */$ t9 E; `$ `! L2 F& c+ e
.closeButton {
# f7 V% i6 P0 Q: c- i position: absolute;& h* f; B/ O. B! c
right: 25px;
1 R7 n/ v8 e& g& v: j top: 0; W! v; `, p4 M6 Y1 Z
color: #000;4 S( l9 f3 c. \: X. o9 u
font-size: 35px;
, A6 o; v7 S# `, M6 ]% q' ?' I' ] font-weight: bold;
: E k5 N8 n! L9 _8 J8 Q }
4 G9 J. ?/ D: x+ Y( `# z' S: a6 M, O( ^+ E) N5 ^ @
.cancelbutton {; y$ x/ ^( n `$ J, f4 Q
width: auto;
, L9 f* h$ e$ ~$ F2 n% r% Q. t padding: 10px 18px;1 B8 H: i; D5 q- _0 z1 x( D$ f' ~4 S9 [
background-color: #f44336;+ o% H" |( T4 R( `: Z6 {. k& W
}" B# ~, w- f- M+ u+ {
# R; C; m( i: B" [$ T7 o# T o% y span.password {
* a- r' ^$ U( D) T# \# ?& u7 e/ V float: right;
2 B5 G, w. Z) v& @4 k padding-top: 16px;7 M# q9 ]; a& p5 i
}
& L' K; }9 X. g+ ?) j+ {
/ E8 b* t2 t3 M .closeButton:hover,
+ v% C0 U0 U8 }) V( \7 i8 E& f( h .closeButton:focus {: \, ^6 _! y" J: p3 Y5 _# e# e
color: firebrick;
1 h# ~% l1 x4 U; \% G5 C- ~* ~ cursor: pointer; o- ?( G- ] t! x9 \' ?
$ {3 g$ v* i9 s6 d, F# U: _
}
# ]8 b: g: D) g9 @5 I: u7 u/ J' `3 M
.imgcontainer {, @, [2 O- V/ f+ I" Z2 A; T+ P& A3 r
text-align: center;
! [3 N1 F% j! q5 J6 K margin: 24px 0 12px 0;
1 `$ H& ?7 S3 I0 F0 N( C position: relative;
8 \7 T: N" X4 S& y/ p* `0 N }, B3 l' H" Y' |* R& H4 w" W
, \& O+ z% r: T0 E. J3 z7 n4 \
.avtar {% S/ r h/ D3 } v' ?
width: 40%;9 Y# O4 b; ?( ?2 d3 W+ N( A
border-radius: 50%;% h+ I- K8 L1 r+ M) L9 c/ P& [
}
+ Z" i: P" x- ^9 s
! }4 C3 A G/ z1 r9 [ .container {5 ~1 X8 a3 V5 [8 U2 e/ E
padding: 16px;
6 W8 Y6 c$ _8 f; _8 y }
- v! z8 C* ^) X' ]- l% U! _9 O
- S6 L8 v! P, Z' \# _+ } /* Full-width input fields */
+ Z9 i, d8 K/ N& i( a input[type=text],
6 t6 m' |) p6 {) J* C input[type=password] {
/ e) }" ~! P2 \; ?( L1 a0 Q& h9 F% ^ width: 100%;
+ G @; ~: b, [( C3 l padding: 12px 20px;
9 r6 w5 ]% i8 R7 c0 K+ Y margin: 8px 0;
" I% q4 |. b; {; ^' Z display: inline-block;! V" g6 Q' r2 e! `, x3 G: |
border: 1px solid #ccc;
& f3 @! Q9 Q8 w/ t: ~. y box-sizing: border-box;
: X1 K/ s1 f) e7 A0 ^* k }
6 f: n/ G$ w" I" s- m- l+ m$ T N' `
4 c! D9 }1 U$ W* Y0 i1 v# r /* Set a style for all buttons */7 V5 Z' a {. }1 |" i& j. L% |8 V" A
button {9 x4 @# w9 m7 Z0 i \7 ^1 ~
background-color: #4CAF50;# y7 | s8 B/ {) x! R: V
color: white;
" U- s, [7 E+ u$ c8 R padding: 14px 20px;, [: {- n9 m: |8 y2 ^* G7 j
margin: 8px 0;8 k0 h7 `$ Y4 Y7 N
border: none;0 Z( r; Q# X+ {& O# p
cursor: pointer;* T3 l0 E; x, q* ^5 f+ W3 I
width: 100%; i' B' w9 ]0 q/ r- ]
}
8 }) V5 Z3 i0 j/ t& d5 ^0 W) ]: N. @7 k8 a! Z( F* L
5 ?* F' ]$ \" S% L2 a+ ? button:hover {. {: t6 F& } Q. p) f$ I
opacity: 0.8;; h6 E2 Y8 b! Y7 R* [8 n3 X) O$ C
}
o a* E2 [6 K! P H/ m1 v
+ s, w, k; w/ F, h4 q /* Add Zoom Animation */
0 u0 ~ N D0 ~* V- u .animate {
$ X9 Y9 M( U" i/ g -webkit-animation: animatezoom 0.6s;
7 W" u) y, f; O+ }2 Z$ r2 N animation: animatezoom 0.6s9 v8 R' l \( _- j
}6 X- w6 T, ]9 a6 @- b
+ y" u( M% D/ Y4 o1 z% N+ M
@-webkit-keyframes animatezoom {
0 @) ^* T+ |& Z- ^: E$ E from {9 l/ X2 U1 a$ S; ~
-webkit-transform: scale(0)( f2 | w# L8 R8 F# u
}
: f9 ?" v, Q2 ~- T. p
$ f/ U4 e8 R T to {
# H: i: y8 R* ~ -webkit-transform: scale(1)* l# ?: u# @% d* E, R3 J
}
5 L) k# S% O* ?# q" g }8 ` R' L k. u, j$ M8 }3 F
! K# x0 n: X) v( _' i$ {7 H* O$ O( ~
@keyframes animatezoom {
/ p; X8 V' u' C' n5 J3 v6 \" b0 T from {
. @' O! B8 ]# f6 r transform: scale(0)
! w/ I, C) C- c" D! E/ z! t' J, | }
- M; U# b. Y3 s6 V) J
/ z: ?, b' [: X! \7 Z( k8 W ^+ E3 N to {
8 v& w- i9 T- a7 A& N1 I transform: scale(1)( d y( F% g) \4 Z! ~
}
, E+ h7 d+ V2 S' b" X8 {( f }% C& v# _$ C$ `7 K
/* Change styles for span and cancel button on extra small screens */3 Q* y' _- r: i
@media screen and (max-width: 300px) {1 K8 `+ M0 D) P
span.password {9 w/ J/ c9 v- ~, Q( q8 ?1 o
display: block;
7 C \+ ^9 F" p6 V. M float: none;
' u' s( A) x8 r }! x5 ]' ~; R' v. e
+ }3 L) w* c7 |! y .cancelbutton {
0 h5 c, @2 D6 q. t) ]1 o; U width: 100%;4 n1 _. o# e. I, J
}
& l7 E& q$ G. p! H! e }
, G5 ?! ? @9 i9 D6 V" P+ Q' M; j </style>& D4 q/ u9 Q' M# }. J
</head>& b Q9 f. d, U( L( v, h5 A% n8 }
5 H0 @& m, C4 o- @
<body>
, s5 X9 C4 y+ _; w( T4 B5 f, c, z
! P! J9 n4 M& b- ~6 J- ~! A <button id="login">login</button>" E/ r, g& m% ?9 |% e. s+ E6 Z3 q
<button id="register">register</button>+ B" i9 S* _7 S+ Y% b
$ ^5 ?3 T, e" E# ^0 k! g% C+ E <div id="formPanel" class="modal">
% p! s( |5 [& ]/ d <form action="./img/logo.png" class="modal-content animate">
7 g# H% Q5 z2 X <!-- image -->
+ \9 e6 v. a- ~ s B1 K/ [% I* T <div class="imgcontainer">4 H" g! f# D7 E" y
<span id="closeButton" class="closeButton"8 [ h9 y& i' V- O2 s) |
8 @1 l# s v' r; K+ i5 H7 A title="close form">×</span>
! \; N6 ]" n0 U# R1 ] <img src="./img/img_avatar.png" alt="avatar" class="avtar">
4 Q6 L5 Q, s, Y x- ~ } </div>
$ q$ D) e! q% b- {; H <!-- information -->
; h' T# i$ N8 u7 \( J <div class="container">
i8 s" e( z( Q/ m7 t3 K2 H <label><b>UserName</b></label>) Q, g( O0 V; q* A0 w2 ?) {
<input type="text" placeholder="username" class="username" required>
4 V: E/ g7 U) u* q3 m- S; }- m <label><b>Password</b></label>
. M: ~6 ~8 }; d <input type="password" placeholder="password" class="password" required>8 m* K# P6 d ~4 Z u9 T; e( P3 n
<button class="loginButton">Login</button>
7 h4 \! S+ v/ p; |. ^ <input type="checkbox" checked>Remember Me
7 j* o1 U. [0 b# g) z$ Y$ @ </div>
+ K1 L, b- m- g
0 |2 G6 m& d) E6 s2 t' Q <div class="container">( g1 I" W+ [5 Q) m# q
<button class="cancelbutton" type="button"
5 `5 C1 f% t) E! r* {- Q$ o7 p >Cancel</button>5 K% d9 W: [$ [
<span class="password">Forgot. t" I" c6 B1 f3 Q0 E7 k( O1 v
<a href="#">password?</a>- q. D% J' B0 ~/ X" q
</span>
( }' X8 ^ m' \6 f5 w8 w1 y </div>" ~" [, f8 X2 f: F# U
</form>
# @+ V( `1 x7 ~ </div>
9 f Y- H* G: s5 N, _
" P+ O9 D+ q$ v: @6 L! H6 W
, ^( ?0 P5 s5 z) M9 P4 x3 N# R <script>& Z3 ^9 {4 U- e& i) g
. V/ X# y( y, m1 X* q' x9 |6 ? function loginForm() {9 T2 w5 l! |* }$ V" b9 N
var formx = document.getElementById("formPanel")# H) \% k5 e) \0 K: D, b- ~
formx.style.display = "block"/ b! o x$ m/ Y4 V! N6 X
}8 x4 g) d% p7 `2 u7 M
</script>
6 L# c/ }& O# Z9 p$ r: e/ D6 [! U& O4 x7 t4 H$ S1 f
* h* ~0 o% S8 q7 H9 t</body>9 r w" s2 w& u: C: C
) y4 o9 ?: X5 I6 N: D# b7 ~</html>[/mw_shl_code]# P: w' U: U; b) R Q* s2 \
) u* i/ }) D/ q; | N, g% u1 S4 [1 s# @ p+ r
注册代码8 k' T1 G ~7 a3 Y3 @! b( g
" s: s) U+ h$ I9 W4 g
[mw_shl_code=html,true]<html lang="en">
( ?- S, |: O) c9 D2 {- t$ t: m6 c, R
<head>
2 l2 }" O1 t8 s% Y9 P5 G- C) ? <meta charset="UTF-8">9 u$ {- j; Y. }- i( @/ E/ U2 @) X
<meta name="viewport" content="width=device-width, initial-scale=1.0"># ^0 \! Z& ]' D6 s& R0 p
<meta http-equiv="X-UA-Compatible" content="ie=edge">
* n# C9 A6 j7 { <title>register form</title>
( A$ v* l$ V+ B' Y
4 r/ l2 L6 f, Y# [; z7 ] N0 U6 Q <style>
! D& m+ F+ ]- n: X$ t7 d .panel {
. c! W" D$ `4 _9 d width: 100%;% ` x# z8 S* f5 H @
height: 100%;9 Z+ ^7 I3 W/ {& B3 ~- e
background-color: rgb(0, 0, 0, 0.2);" Z$ Q' r! [7 N- H. X
padding-top: 30px;- a) ~/ b+ {2 H. K/ \
overflow: auto;
" T1 W) [% i: f! o, D$ z9 d3 F6 } position: fixed;
4 H# k. X: b4 _ left: 0;
5 L/ i7 r/ e6 k& l) a right: 0;7 G# H5 w& i5 L: q
z-index: 1;; M+ d/ i; @# v5 L5 e$ d
}
) i+ A. W P" @/ ]. J8 r% ]* h- ~4 W
* e3 R; _ q4 c .modal-content {$ Y9 {+ x1 N, n, n. {: a
background: #fefefe;; N( V+ ^4 z* `0 O- r! z. R
width: 60%;" z6 }# W _. ~- R3 s' S
border: 1px solid #888;
$ J, H: s+ L6 k: I( y( m margin: 5% auto 25% auto;+ y1 o4 f( S2 w: T: e7 d
# M e% n( `$ C8 \ }, H* E: ]& F- U: J4 N% Q
0 `" a1 L3 y/ A, b5 c$ l .container {4 d) c/ `0 f1 M$ M+ w4 q
padding: 16px;) c' E" r; T! M- V3 H: Z! |8 ?$ M" _
}" i3 J: O# ^% S# r% n
* x: z& D1 S/ d8 m5 f
.close {
/ o9 j8 d) R4 `4 `: n4 M5 r/ D font-size: 40px;
" U3 T6 ]- U8 [3 I. U+ Z position: absolute;: F) W% o' k$ t: W9 U
top: 15px;+ {1 o4 s6 D9 K, ~
right: 20px;5 k% W2 x$ h2 q$ I6 \" c
}
9 H" H* a& F" |8 {3 E
6 O& @+ o4 B3 o& ~ .close:hover,& D/ b1 D" b1 V0 Z3 ^
.close:focus {$ R& P6 s- i* Q1 Y/ o+ y: r
color: red;
- S3 R3 l* }7 [$ J1 G, J- ~: l cursor: pointer;
6 O1 W) r5 `; p }
. K3 d1 \ i$ T( H- ~4 c' |! f5 @# O( ]) P- r* {
input[type=text],! f% V* ~3 R6 h# {
input[type=password] {6 C) F$ n+ m7 u, n) A0 M* S
width: 100%;/ C& c4 h# B* Z/ h& Y
padding: 12px 20px;
5 u1 J$ \, ~$ M1 p/ A& B margin: 8px auto;
# F+ X1 e4 a! f" q( L6 k/ ^# g border: 1px solid #cccccc;
4 u. e0 j+ z- Y3 O- ~5 T display: inline-block;
e0 J. I( u0 R4 `, ^7 Y }2 Y& e$ e' N# T0 V; y. q, H+ P
0 {- z- ~# c! i1 W button {
% ]5 U/ [4 t9 k- ? background-color: #4CAF50;
; [9 a, M( a9 Q" X8 P color: white;
2 C* Z" [# W9 N4 Y% N0 A padding: 14px 20px;3 A/ M2 U+ \ ?, V
margin: 8px 0;
4 ^! j2 N0 p0 ?+ e" j border: none;. q! j/ R0 X- W6 O
cursor: pointer;
% M( s% [3 }- \* w width: 100%;+ l; T1 W$ l& t& ^; K0 L
}/ G3 r v1 A; z# d
" A6 N. _0 h$ d- k0 B7 V
.cancelbutton {5 ~- t4 l5 Z/ _2 ~6 Z2 S Q" Y, o( |
padding: 14px 20px;7 p8 T- b8 n# l7 x. N6 A% K
background-color: #f44336;6 y/ p2 b8 `* l) Y9 T4 B1 P$ e
}: R( L U8 v' H
8 @: a( f$ n1 E1 A .cancelbutton,; h- W! T. u% T0 o) Z
.registerbutton {
2 E6 l' C/ V7 N1 S9 } float: left;
# X+ H8 G [. I width: 50%
9 v7 w/ @' n& |5 ~' A I }
8 g9 J, U" B! g" K5 l2 l. R8 t
2 M4 a. o$ l' k6 S6 `! G .clearfix::after {4 v/ P, W, O9 |4 u0 F) Q
content: "";4 {) n/ S; A0 L# o+ ~8 v$ ]) n
clear: both;
0 q9 N5 ~/ r4 l) o display: table; W8 ]9 P$ X. V! P
}
6 ^8 d8 M b/ N* x; E" j3 { </style>9 R' U( }! \) \( J4 r) G9 ^* W
$ m& `0 H6 @9 s; c: H3 o' }- S
8 H; l& {$ a4 O
* |$ ^9 b5 {" E; R" u3 m</head>' m* U, \% C9 a
% W! S$ r- A2 [5 p4 v) {+ k# J<body>: m8 F& y8 U8 Q. I
( u5 @: Z4 X7 Z7 m$ Y' |1 L' a
<div id="modal" class="panel">. M; \) X m' ?% [. B
<span class="close">x</span>
1 h4 ^2 a. F0 E4 \4 ^2 n/ e <form action="#" class="modal-content">
1 g! C& m- |# ? <div class="container"> |5 F+ F9 Q- v
<label>Email</label># r: |) @( x' k( ]! ?& \) Z8 ^
<input type="text" placeholder="Emmail" required>
$ [, Q `, e6 S E3 \! i <label>Username</label>
! C/ q8 D6 N; t E+ v <input type="text" placeholder="username" required>% ~8 e2 x% a9 X( i
<label>password</label>
4 a# d: a3 j- ]1 c! P# v <input type="password" placeholder="password" required>
2 a, j9 b+ y) m' x/ t5 G4 W$ L <input type="checkbox" checked> remember me
$ Z, X! E/ m) A2 t3 k+ w3 L <p>Follow the policy <a href="#">terms & privacy</a></p>: m7 |. R1 x/ Z
% X2 O. Q) f; ~! O$ q. I% P& I2 L I! i5 [
<div class="clearfix">! R' V+ O' s& b( e
<button class="cancelbutton">Cancel</button>6 h5 d$ N' { d
<button class="registerbutton">Register</button>. v4 Y- Q9 r* k7 s
</div>8 y) k7 ?- m4 \9 G& J u7 q
</div>
: b3 Z. V, B) h0 G3 j </form>$ |& C+ F* l% ^& n
</div>
& |, v2 _0 H/ x9 V. o
- F7 F/ q8 N x+ J$ Z# W6 M7 x9 B$ \* r5 K/ d+ t5 A
% j' m( J3 a& p/ Y- |
0 @* f9 A; l* {7 C7 _2 J5 i: w6 Y" l b2 q/ M H5 |
</body>
; m1 E- N; n |8 A+ b2 Z3 Q+ l0 O, U4 j! L. Q7 } r
</html>[/mw_shl_code]$ l. W& x" t& Y
|
|