|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面% J1 E$ \' k1 v; i& w
8 C# k% a. U0 A
" V" l: G7 i+ V! d登录代码:, x. e6 k+ {! ]4 G1 X7 z( x! n
: \: P; t: u) ^8 |2 h[mw_shl_code=html,true]<html lang="en">
8 m Y' V2 O" F: o% ]
; [( t8 l: B1 z0 Y<head>' k/ \! A, X9 e! B/ w' L; N; O
<meta charset="UTF-8">& _2 k- V6 Y! T4 ?1 N; G4 j3 \/ ^
<meta name="viewport" content="width=device-width, initial-scale=1.0">3 I- t% s- s- c3 x7 }8 p" n3 f: f& s
<meta http-equiv="X-UA-Compatible" content="ie=edge">" a# [" I* R {/ h( ^4 ^8 a
<title>This is a login form</title>4 W6 e4 c" a: u
% _# R+ Z$ @: K% K <style>3 I5 {) b% m/ U1 P: S( R: Z
.modal {2 X/ D- P' M; F! B
display: none;
+ g5 _) r; L0 w7 O1 z width: 100%;
% K$ [. b* b2 B2 L7 [* b height: 100%;
( B: _; t0 ~& H position: fixed;
6 f4 a! G! \% L) p: B+ R0 \' V overflow: auto;
; L" s* J6 D( M1 y z-index: 1;
' e1 w8 V7 o. y8 } left: 0;$ N9 P+ T/ H' [& }
top: 0;
( }$ F1 z; D+ R4 H. E8 H background-color: rgb(0, 0, 0);" O5 J: ~3 {& a' P* K
/* Fallback color */
/ C8 o( B5 c, f* U background-color: rgba(0, 0, 0, 0.4);
R* k: S5 ~. G /* Black w/ opacity */) H% o! j' q! t8 m
padding-top: 60px;
* S2 w% g- O9 u3 P
" ^; G, ~4 \7 X4 ?+ }- S; x, N: b }9 Q( {5 v2 |" Y7 H1 E( F# ]0 G
# @% m8 Z1 B5 z. L. p- q! ] .modal-content {
; C, h1 W! Y- U width: 60%;. D; t" U2 Q; H* B. N
background-color: #fefefe;
; }0 M% N! k, f$ z& E5 ~ margin: 5% auto 15% auto;
2 R6 _, t3 {6 a9 v6 N! T/ ?3 Y4 G border: 1px solid #888;- e3 H; J; z# |1 x+ H
- h5 g2 C1 b4 Q9 p' j9 v }
9 Z K) E! f M0 ?- X% A' ]0 d3 |* _0 ?0 p- q5 t
/* The Close Button (x) */
1 Z3 }% x# K+ Z$ X5 N .closeButton {' v8 t3 L) {0 l- p7 J: l
position: absolute;8 @0 ~- C; s5 G' p: Y; X
right: 25px;% _- ]; H- Z. o$ d
top: 0;
1 }% p+ W7 C. m4 ?/ E( W color: #000;1 Z! \; s1 z& }$ H% F
font-size: 35px;2 r5 i% [8 a9 J% s: }4 x4 `
font-weight: bold;8 J7 ]4 e1 f' q2 C4 i
}
. `4 y7 r5 a$ R! a
5 G' o/ z( @* O1 ~ .cancelbutton {
# b% q% p e* q& J4 y# T" F width: auto;. W% z! T, b6 O' H! m
padding: 10px 18px;! Z8 K L- Q; t$ G
background-color: #f44336;
% \& S- I; R& ]' p2 O }; f5 |- d5 y0 {) r7 q) ?
" @8 z& ~! B! J span.password {
+ W& U" \( y \# J float: right;
4 Q8 ]! U0 @" n" Y2 s. w padding-top: 16px;
+ y& Q$ F1 t/ j( r% ^5 W) E }' r$ U) F2 O$ ?% i% ^( v7 s
9 S) c- `- ?3 ` .closeButton:hover,
' A; f% n# y8 A, p; z6 n .closeButton:focus {3 \6 g3 T( D8 T$ R* O/ _! s
color: firebrick;
! r6 Q$ v" g0 a4 c9 D1 i cursor: pointer;- p' ~9 F2 y+ j% H
_- q0 k; s* N4 F0 W# _ U0 v1 N }
' t y+ F5 h# s0 Y9 v8 u1 d; s- _/ z
4 j; U, u/ S$ [, D& K) x, U0 C .imgcontainer {
! l# s4 J& a1 q8 b' C text-align: center;
5 |2 c4 c4 S2 U. V margin: 24px 0 12px 0;
4 H; u5 s V. j8 {, a position: relative;! P( |4 C( x7 F$ T
}
. \* }( ?0 s/ l6 @& }5 g2 i
1 F/ n$ y& c9 r$ Z ~4 J .avtar {
8 a; L' b$ ~) A* i7 d width: 40%;
* J1 L/ ^0 g g6 M# V4 J border-radius: 50%;# m+ m9 L: z; w" s
}: t) `' ]# K/ _- r2 G5 B9 }
. G1 G- A# Y' h% \
.container {8 c9 O; @) P; C$ D
padding: 16px;
0 ]( U) }! c- ]7 G H; h4 T }6 @6 N) I0 R4 f
- j1 v4 @. d' U$ \8 L
/* Full-width input fields */
+ {# f6 a; c+ O) j5 |$ e input[type=text],
5 N4 t/ @3 ~+ | ]6 Y8 U input[type=password] {
4 m. Y2 r: ~' h0 @ width: 100%;6 H# h- ?. B) B( `. b! I
padding: 12px 20px;
9 n/ i8 }2 _" j margin: 8px 0;3 e) l- z8 Q* F/ _$ j: b/ d- ?
display: inline-block;
% \' Q" E' S3 U; h3 I border: 1px solid #ccc;! J5 [9 f# k: z. r
box-sizing: border-box;+ u: v+ d2 B, Z5 E5 [) F- N4 k" B
}
, m! O K! q# ]9 N1 n l; e) l4 [# w/ ~) M
/* Set a style for all buttons */" H" p3 i" A$ y% U- I
button {
) a0 M! }; H3 s" M0 S background-color: #4CAF50; Z9 p! t7 X2 F' E
color: white;6 {3 ?6 w) l" N9 P7 U2 q
padding: 14px 20px;
3 M! H& ?; L5 o# |( n8 t margin: 8px 0;
+ b& }0 K3 I, d1 r. K border: none;2 \# U# e6 u3 Z! x
cursor: pointer;
6 l) ` }! d- P* l1 f width: 100%; c* E1 U$ h# g7 Y
}
5 i6 |) Y2 M$ _% A/ L2 r' N
! l! x/ c( a8 d7 @1 f5 W0 a4 Z. w( Q, n/ C, V
button:hover {
5 {) `5 K/ B5 n7 y6 m- I6 i opacity: 0.8;
; P! |) O, t. D }6 G' Q7 g* W j5 M4 n
4 O1 `: W8 n/ P: t8 x /* Add Zoom Animation */2 w$ b: X' M" I0 T' Y
.animate {9 L( I4 Z( N- f7 I+ z
-webkit-animation: animatezoom 0.6s;4 P3 k% y, B( A; T
animation: animatezoom 0.6s
) N) N4 y: _+ R }: B6 G5 }( s, C" c j/ c
b e9 W& B$ J7 B) G2 y9 f @-webkit-keyframes animatezoom {
7 B1 m3 A; E8 ^( }5 e5 g% l: Q9 k, z Q from {( {8 P" M7 r9 ]
-webkit-transform: scale(0)
0 q/ e3 u" _3 u- Z0 W! Q _0 t }+ k% a3 i; y( `1 B8 a
4 I% o! P; }# N$ Z7 c to {
4 w* z1 x; h# d/ g$ ] -webkit-transform: scale(1)+ B' h! D- u {# z: h3 Z- {' t
}# J3 h* y/ o, K# V( Q
}! v- B" E$ d6 b1 |" v L: J: v C
" c7 D. H6 S2 \3 {( X
@keyframes animatezoom {
0 B, f/ \$ v \" x. J from {. z5 ~1 B6 }& I( u6 m, ~5 i+ T ]: ?
transform: scale(0)! `( r6 q! u+ ?2 Y5 V5 j p; o4 b
}8 r$ m0 a. J4 q
* D1 [5 F8 Q* s0 W' N( N, e
to {
: I2 {) B$ E% ]* j% p& j transform: scale(1)+ ?, ^& t6 X8 C; O3 P
}8 a2 e. |: V9 ^ p- g1 h
}
9 t J+ }- N$ b; o /* Change styles for span and cancel button on extra small screens */, I- j/ n. ?/ l
@media screen and (max-width: 300px) {' a" R( `! d; b) ~" r/ h
span.password {& h7 B9 A4 `# ]( p% x0 X2 n9 Y* ~0 h8 }
display: block;& @- u! d& l& Q
float: none;
) X( E; l4 h$ @6 b% M, w' R }
" L2 }$ m( t" Q/ B( R& }: \2 n: e3 k# N" T7 o
.cancelbutton {
5 t, Q! M" @3 t0 D- v1 X/ n- ^ width: 100%;
) K3 ]3 `9 h9 L' I }) @% z0 t; K7 i _/ n) ]
}! q w- R8 i3 m4 C( a0 Q
</style>7 V% `+ ~0 {6 W0 Y! T4 T
</head>. E) }6 `/ f' x) v: f, _
! M7 K0 S- M! ?) e
<body>
F* c. q: t* [" F4 _" b
& p; {8 ]- e/ Q; | <button id="login">login</button>/ R+ f, r* H# I: o, v, J: l
<button id="register">register</button>
1 P, N& Y9 m+ Z5 ]# z( C
6 W' R0 K8 B1 i7 k <div id="formPanel" class="modal">% p2 D* ~( k2 X1 ^( `$ ~
<form action="./img/logo.png" class="modal-content animate">
3 D O! I9 j: \ <!-- image -->1 {0 F" H; [3 [$ y8 H0 ]* p
<div class="imgcontainer">
& O7 A+ h% G2 P# k) q% g: p! A% H <span id="closeButton" class="closeButton"
% z7 _5 u/ ]- s- [5 C ' f. h% [* @. d' Z$ j& s w
title="close form">×</span>
: T) l- ?& Q6 ]9 o7 i <img src="./img/img_avatar.png" alt="avatar" class="avtar">& P: s; A$ |2 J d) G! E
</div>
& A5 ?% h" w- c _; N0 z <!-- information -->6 L/ \/ o2 C4 F# [7 L/ V0 P
<div class="container">
( J# I N- O& Y& J- A4 n; m G <label><b>UserName</b></label>
) ^5 j, _/ w4 T N <input type="text" placeholder="username" class="username" required>% w1 q( Y" y3 f% B2 n
<label><b>Password</b></label>+ B& `1 [ T0 \8 t" c# E" G- h
<input type="password" placeholder="password" class="password" required>
3 Z3 e+ a) L- N3 f. y <button class="loginButton">Login</button>' ?0 g- ~: ^7 T" _" @
<input type="checkbox" checked>Remember Me" ~* ]7 Q0 {1 Q, g
</div>
; G: H8 ?% b" C o( H+ X
b! p. m( f! U7 }0 v3 A. H <div class="container">
# W( l2 G' ~& I2 T% T" _ <button class="cancelbutton" type="button"
, \6 e- z6 a' a2 Z& M: {& b" G >Cancel</button>' ^0 h$ D% ?8 w' [ @) f
<span class="password">Forgot4 W) ^! t' ` [" m2 z9 b. }
<a href="#">password?</a>
3 U: |0 h6 a: }+ Q7 M/ E0 ? </span>
$ W% ^3 K6 H2 b% M </div>
% }2 H% Q1 \ v6 t& @; [& ~2 Y </form>
9 o. a5 ~% N3 A9 I& a% m# I </div>% I6 m1 u% c- o/ }+ p# M4 O
# j1 ]7 N4 l2 |2 O3 K% ?8 @5 ~
# ^: N/ k6 o n) z/ d <script>- N) D$ h8 o' Q. k
T; o8 c+ t% J& P' Z+ B0 L/ s
function loginForm() {
! |; ?1 K' C( j) O var formx = document.getElementById("formPanel")8 b1 |% f& p6 X4 P, o K
formx.style.display = "block"9 D! x+ f( W. K: f/ V
} L3 M* q" M, q/ K7 t( h
</script># \$ D" B' ^ |8 w
- g% g0 M2 B0 Z% f% D: A
5 Q3 W- T) g/ V! w4 E |" l</body>7 y9 F" G# j& n g
( r5 ]' t9 ?9 i1 r7 o: o0 d3 S</html>[/mw_shl_code]- K& \ v% A# [9 F8 }
: W6 }$ [; j$ t
O5 Y; S( u# R$ i2 o" y9 b注册代码+ J0 C2 H+ O( J. L3 x$ F9 z- g
% Z' V8 R+ L- K# b3 q
[mw_shl_code=html,true]<html lang="en">5 c* Q- W" ?& q3 d2 _
% o, S. Z# Y5 X. k3 B7 N3 u
<head>2 h$ h2 d1 ^. _ B0 G3 X9 U
<meta charset="UTF-8">* V; D* B G/ T* P1 p- I. ~
<meta name="viewport" content="width=device-width, initial-scale=1.0">0 z6 k, {% w5 A6 p% h
<meta http-equiv="X-UA-Compatible" content="ie=edge">7 z& g/ \8 C5 G2 I- Y2 X
<title>register form</title>
6 M6 L- X. h' a8 F/ i5 p; e
2 H+ ?2 S! q- _1 P* f( v6 V <style>& b. u5 ?9 _& d# q( r, b. a. B
.panel {$ v* M Q {; o) w# h# P
width: 100%;
1 d5 j, U1 B3 t+ ~6 `2 S height: 100%;
! W; Y3 z* x3 ?* d; ~( s+ w7 q background-color: rgb(0, 0, 0, 0.2);3 B) v: ^' ^& y, N+ k2 J0 F3 [
padding-top: 30px;
' p, D8 l7 |) [9 V4 @+ A- } overflow: auto;
4 N" N1 d3 a0 Z+ h! s% f position: fixed;7 U6 L* L6 p* G( F$ `
left: 0;
1 ? u2 X6 u7 t. A4 ~# J3 |' |# p right: 0;9 ?) E/ C* G$ G1 i3 b
z-index: 1;
" }5 v/ z% k5 m }
& y$ ~. z: ]) d( F' i8 l+ D# q: s" f$ D! c% Z
.modal-content {) a- j/ s& i& A3 z/ J; l V. o# F
background: #fefefe;/ _& a# C$ R4 ~: `+ w
width: 60%;) G/ G0 w0 m! ^ ^% T6 i1 J6 ]9 t) U
border: 1px solid #888;
5 v" P1 G. |) L8 K. ]1 j margin: 5% auto 25% auto;
, @8 z! F# a5 m9 g0 j0 _
7 a8 `$ O+ ]) K }
7 v D; T% m! G, a! T) J e9 e* q6 E) i
.container {
3 t3 v z0 F X( U/ s) v' J) Y padding: 16px;- ^) b4 `3 C" b; A
}
( |! ]3 j& p3 e$ z. U, ~: W
- \- W3 r' B5 G1 n9 e9 J6 l .close {
/ w3 O2 w. x# j1 l. _ font-size: 40px;
# m1 R; U. \+ z/ H; X3 G. b position: absolute;
" h1 D% ?& j+ |6 _' A top: 15px;2 e/ t- N6 Q0 W) Q& [+ R2 T8 b7 d# X
right: 20px;8 e3 @6 u2 C" N' t6 f; _4 x9 q
}
( r$ O4 p8 A$ S2 {; ^/ N& t* l+ F, @+ Q( M$ B/ a& _/ h3 X4 F
.close:hover,# {8 U4 T. a3 A8 l9 p4 K
.close:focus {% Q" y, e+ H. V% h2 F
color: red;
0 C0 y, H9 q V6 T# J) T cursor: pointer;
; N+ j. B, {. ~4 m }
8 K; E0 z9 m; F- A
5 q: a* C/ p$ ^ input[type=text],6 \/ [+ v3 Q y0 M8 n# t
input[type=password] {
* e' d- K, a; W7 d& b width: 100%;$ e' Z2 q6 b( ~" V4 G
padding: 12px 20px;
/ b: b/ @ d$ L1 \) z2 x margin: 8px auto;! t6 A. _" a7 T a
border: 1px solid #cccccc;5 O2 t8 u3 g& c
display: inline-block;7 Y8 p/ w, M. y3 i1 h
}. _! u( o, Z( [8 T
- F# F1 i w$ N2 t6 ~ button {# Y/ R5 W8 h/ ]; T" ^* t
background-color: #4CAF50;% p) \5 ~% l. ~, `7 @8 p! y
color: white;
6 l, ]2 k, K! |6 o. S padding: 14px 20px;0 s/ i9 X' x( T
margin: 8px 0;
5 h4 X8 m" ]) d; ?( P7 @ border: none; q5 E: _% ^' R6 t3 C( U0 N
cursor: pointer;
3 @; H: r) Y! J7 \9 x width: 100%;: s" W0 R8 W8 X1 Q) Q$ ^ k2 a
}. b1 r3 q, ]/ B" m
P6 x% `. Y. C! d .cancelbutton {
: ~$ K$ [; I) J) Q padding: 14px 20px;# R/ Z3 k9 d( c! s. a$ n
background-color: #f44336;
7 C' O# b/ @6 ` }; t+ I! |- G! o% E, Q0 }0 N1 ~1 w/ L
+ o" x4 J; r$ h" g. R8 H .cancelbutton,% v6 F/ w0 F9 r; P* T9 t8 X1 Z* o
.registerbutton {
3 Q: Q' x3 f5 A* P. P' g float: left;
0 Z6 Y+ x3 \6 i% _ \% ~/ A& M e width: 50%5 r' w; J( f, T5 R/ N* R* @4 R
}+ I3 M9 x) e3 E. S( `8 g* ]
0 j% _) C' k1 F0 k+ t, a
.clearfix::after {
7 K4 g: }6 _$ k" ?8 r content: "";
4 l) m' ~0 S4 E8 L clear: both;" c Z' j% P) V1 t2 }, r" H
display: table;5 `( I( |6 q ~ t1 b! f* K- m
}
4 b7 b% X% a* A8 e2 H3 Y! f </style>
8 V+ \: h" q& S$ q7 `. d( B+ }" O9 i8 U) u' X3 b- a& ]
# W% b; k! w. g w
0 H, t: |: d. U4 l, `& N: `
</head>( N3 I0 T2 {/ ?8 w# ~
R/ R' M$ y+ W y
<body>% A. A5 c& h! v8 G0 D$ H. T& q
. i/ R( j* n4 W+ g% U/ @
<div id="modal" class="panel">6 q/ G1 c3 o8 C* F
<span class="close">x</span>
5 w# H1 R2 J+ M/ q! w <form action="#" class="modal-content">
; Y7 A6 B/ |3 G$ U( J3 f <div class="container">
- i) S8 K8 N! c; {6 I, U <label>Email</label>
/ ?4 S) ?( i+ K# }0 Z% j <input type="text" placeholder="Emmail" required>
4 `7 S- Y' h3 p2 o <label>Username</label>* J5 Q( A# T+ v, [( |, Q
<input type="text" placeholder="username" required>* ?, j3 D" n* P9 g* T" v( n
<label>password</label>
5 J y" y3 _/ R- c" K( F& d: f <input type="password" placeholder="password" required>
+ I3 |8 n# X+ W <input type="checkbox" checked> remember me
' E( c3 {& o8 P3 Q% Y2 Y- i8 S <p>Follow the policy <a href="#">terms & privacy</a></p>
1 r: {" j( t- M8 |0 C/ Y& @) l- A0 \% z2 Q: W9 s0 U; X
2 i# G, D! W4 R; }- W8 E" ^7 h <div class="clearfix">3 r. p' x) D4 f- \% f5 ?
<button class="cancelbutton">Cancel</button>1 I. c9 J3 [/ U/ u
<button class="registerbutton">Register</button> u; o+ j B$ v! |; S7 m6 _2 H6 I
</div># H2 m2 r' _& y; m2 J& i3 u) \
</div>2 V' P* A( f( F" @$ U+ a3 g; o" |
</form>, w6 d7 `/ g6 n* w
</div>4 J! y( D/ y$ C% F m' H
; K1 X. G- @ O
& I; p) K* v3 `* Y: K% i* d0 e$ ]" [# Y4 m
. B8 f/ r# t+ k, d: q4 m7 q
3 M$ c6 h2 ]/ F</body>9 s! d( w' ]7 `, \ f$ Z9 @
, y, ~3 g2 h2 T' p; @
</html>[/mw_shl_code]' F( [) j6 D. u, V
|
|