|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面- w, C5 c9 U c
: R- K3 z9 O+ U# Q
1 d$ N: _; m+ Y; Q
登录代码:; V; W6 {- t N7 r- h4 A7 J$ P
. J5 ?& r+ o) `$ A" G[mw_shl_code=html,true]<html lang="en">' a* ~% C" B8 Q( m e; m/ d$ s
" Y* a; O( p) e1 @<head>
4 C6 N3 f' G: d/ Y E# l0 }+ x2 F2 t <meta charset="UTF-8">( y- l( g8 S" G- v
<meta name="viewport" content="width=device-width, initial-scale=1.0">
; X7 e7 q& N. K; c9 h( o <meta http-equiv="X-UA-Compatible" content="ie=edge">
) X8 ?3 B( Z, {4 o/ Y( L <title>This is a login form</title>) ~ r, T) ]2 D6 A7 j
, V1 v' D4 D5 F1 j4 n2 y3 \+ A9 p0 [# M
<style>
! n1 [; l: B8 R0 `7 d* i .modal {
/ l; w+ C$ n1 L9 f2 G) b+ G# ?; z1 K display: none;2 w* q; ]9 {# G. o/ m
width: 100%;
8 Q8 |$ t6 p0 h8 i8 l4 r height: 100%;- N: Z6 f7 u$ E
position: fixed;
9 O) Y1 L% S& M overflow: auto;0 X0 B% D- ?: l8 T& U8 _8 |
z-index: 1;
1 c( `. Z! H6 Y left: 0;
8 T. c$ f. v6 F. o top: 0;0 D1 C) ]# F, `# U
background-color: rgb(0, 0, 0);
2 G% U# t8 d( C /* Fallback color */
- f1 ~8 a8 N+ t# S- V background-color: rgba(0, 0, 0, 0.4);
5 v& X) R6 I0 X /* Black w/ opacity */7 e0 v2 N6 S& R$ J
padding-top: 60px;2 ^9 q. a. C; r+ h3 e
4 @$ }( c4 }( @9 ] }
) n% X H- {& T4 _. W4 o, X
2 S+ j* _0 l7 J" J5 e: ` .modal-content {
$ I& y: [7 a7 f, K2 q width: 60%;9 _3 M( `9 B; _/ m' \0 _, P
background-color: #fefefe;( D9 r3 S5 k7 w5 h/ ? a" E
margin: 5% auto 15% auto;
) T* j1 F# O! K# U border: 1px solid #888;3 B# E% W8 T/ S) a5 e, Y
V: W6 c+ ?2 g" q/ B8 O }$ L$ t5 ]7 u# b* U9 b
) G+ }. N* H, U7 E8 v! [7 L /* The Close Button (x) */, R9 r+ v( B! A: T( c" N5 ~. b) v" A* F
.closeButton {
% {+ ]1 y. M6 g, @) B position: absolute;; K" q. P$ S; Q. V0 n% a
right: 25px;1 H' t' O- I' L" E+ _; W
top: 0;5 n6 ], L7 V6 p( M7 O; N; D' E
color: #000;
# S* W" `) O$ p% h font-size: 35px;' f' j! A# U3 G+ r; A, E
font-weight: bold;
; |7 x. Q4 ]: ^: l4 ` }0 n8 g' C5 d* t6 K; Q, M4 F* `
" D$ |- `; {1 D2 L q) t6 h" g .cancelbutton {
0 u8 Q9 i" C, W0 p U6 F width: auto;
& L3 B6 D( D! m! r padding: 10px 18px;: a% N: l( h( Y7 s# V0 N4 c4 _
background-color: #f44336;
- u$ O6 \' w5 f* C8 `# o3 S# n }( S# g* @3 |7 A; I
; M# [9 o. J, ~6 ^8 W4 N5 F! e4 ^% L span.password {8 u- D7 f5 ?7 ]: ~' d8 h% [
float: right;
3 q( g$ { P$ i! K) l7 ~+ m padding-top: 16px;2 ], D7 Z1 B/ ]/ ?5 ]$ d
}9 q- T7 G: l" ^" N1 d9 o! l
" K8 L! @# @6 H8 K* O, J
.closeButton:hover,
% X; p2 Y$ Y5 \5 u' q .closeButton:focus {
6 L) m* `4 c4 | color: firebrick;% H/ f y) e) J7 J- |6 _# {0 H$ r
cursor: pointer;
& o3 [# ?+ ?# H# P5 b+ b! d' b; i2 y& S3 b* I
}
4 f. R2 a6 r" E0 L
, i: C+ L* h0 e+ f1 ]. ^ .imgcontainer {2 b( }0 V* Q1 w3 s% z- P% O3 a
text-align: center;
" \4 X/ u. X4 \- X margin: 24px 0 12px 0;. V0 k: r8 d# g, ]- C0 c: A( k. z0 g
position: relative;- Q6 W. z8 @+ J! O: A
}1 E/ \) I8 ^0 z5 V K+ l, ]
/ j3 B" u5 A# |; z( }
.avtar {
0 r5 ?: W: q, r# o4 q1 } width: 40%;) n2 d+ G' m% p; ]/ L0 S: Z& g, z Q
border-radius: 50%;
& z Z. I9 k7 m }
8 w8 Q9 a8 X8 Z4 y/ A9 P' z% E; U* n( ~
.container {
) V; G+ @! [) K2 k, W. S/ M( U6 N padding: 16px;
' s. z- b4 u' t u: X: q7 ~; H9 h: I& o }3 a3 i6 Q! d- H/ s% Z
. [8 ]2 H4 C3 n$ S /* Full-width input fields */6 R& l w$ R" m. b; _ R
input[type=text],: K' W. P/ s2 M; G5 A
input[type=password] {
$ _, K- ?, ~# d9 S! j width: 100%;
9 ^4 ]! J7 S0 ]* H6 y2 b padding: 12px 20px;* C7 `1 h" K% y1 ^
margin: 8px 0;
9 Y: T* B+ v+ ]9 A% u display: inline-block;
$ C/ ~. ^- P) A border: 1px solid #ccc;
5 V+ M5 l) u. n box-sizing: border-box;
0 o$ J" W) f/ ?! ?* U; v }$ q. h" d' ?4 G1 @$ T, ^" m5 H7 b: }
, j) D. F$ @8 w- l+ \9 W
/* Set a style for all buttons */6 z( Q- H9 f; s+ Y
button {
& N; {3 [* @) t5 p3 o* ?9 {$ S background-color: #4CAF50;
& _' i9 J8 D4 y: A+ s/ S( b+ ? color: white;5 g/ L, E3 G8 K6 O+ T" y s
padding: 14px 20px;
/ o) U( y0 b8 c% F6 Z9 ~; U& @ margin: 8px 0;: i! a9 N3 D5 K* b
border: none;% w1 a9 J# p* R1 o2 E* |1 P
cursor: pointer;
* l+ i5 O5 j4 \! ?+ b P width: 100%;! M$ F' n+ F9 c, S3 F9 B+ S
}
" D2 J6 `% J( _2 I7 A# n5 a. L; m! o! o& I
) l- b$ M3 v, A) Q/ m5 e ? button:hover {, Z8 y# ^9 a- K9 F6 B
opacity: 0.8;8 I5 u# m8 ~6 }# [
}
& ?1 H2 U. z+ V2 l4 Z4 |9 V' X5 M6 k/ }1 X1 c" j
/* Add Zoom Animation */
/ @% l7 m3 b, n9 Z' v .animate {
- ~( h: t# V! h* N5 [, G& j -webkit-animation: animatezoom 0.6s;
: o F1 w0 n$ i animation: animatezoom 0.6s
- m4 ]9 r# _7 Y% Q1 s6 u2 n7 t }
0 J$ e9 w* _* a9 W: W/ `0 r/ W4 Q0 G; A2 q1 y& n0 E* d* u
@-webkit-keyframes animatezoom {$ D" V/ }5 X3 z- p; j# o
from {
0 y! f1 x% p8 ?( Z4 ?% n -webkit-transform: scale(0)& p2 I3 t- f: b S; ~2 G! M
}" |% Y, L' v# R
/ e* H0 m3 {+ t- P" Q to {+ u9 G$ L. u& d. e5 c0 v H4 u
-webkit-transform: scale(1)
$ [# }& H$ E% `! M0 N }
1 \2 ], S L% s% I# h }, x8 O* K5 n8 D0 [- A. _9 D! s7 h
5 u. A+ A% n2 ^6 r& ~) _4 j' a$ u% M @keyframes animatezoom {
2 U1 v1 d( v$ C9 l- L from {+ U$ Y2 V& k( T9 W
transform: scale(0)# |- H: i1 g7 o; \1 u2 _
}; Q, t# o% e; \3 C0 Y+ |. x: K
7 E1 B% _. W* m3 O% }2 k+ k
to {
5 y2 `; [" h# `+ p, o transform: scale(1)" Y( u& W& z/ p" z- G- a
} f+ j+ D6 n+ e5 {8 o+ @3 H' `* S; }* y
}' C5 |. W. @( P4 M6 i3 d. F( z, }
/* Change styles for span and cancel button on extra small screens */
2 v% x1 H& d: K5 } Z0 c+ z' b @media screen and (max-width: 300px) {) v- G) @& j- t, h& `9 r
span.password {
$ a& H# L; `# F$ i3 x' j7 z% y display: block;: F* Y# T. y, B
float: none;$ @4 D/ f' J8 F% h0 b% d# m
}
7 A& N5 \$ R* r+ y( W
& A& ?0 I# p, g .cancelbutton {6 A( W/ z, S% I B q* i
width: 100%;
# Z: } j7 i Y+ I' ~% a }+ Q# E0 t. \/ C2 V# U8 A& ~! A
}8 q3 e: n2 K- b: q& Q
</style>: A% w0 k* P- \! q. G
</head>0 `) C! s) }% b
* n& D5 C9 g/ L
<body>
1 G7 a: O" Z% G8 a+ R; J/ I6 ~$ K( y6 C
<button id="login">login</button>
5 D* g+ L# t0 s5 E% l* W& H9 y <button id="register">register</button>
" a! _ |% z! N+ F+ R6 f5 V }4 i; i2 V- n# l
<div id="formPanel" class="modal">
* P- |3 u' \+ Q7 i! g( T, b <form action="./img/logo.png" class="modal-content animate">- j" F* q' K# a$ _3 M2 H( b; G
<!-- image -->! T4 c0 B' X- z& v! w
<div class="imgcontainer">- N6 X6 h% l* v4 k" S+ d' o
<span id="closeButton" class="closeButton"5 @9 n* r5 Q7 V c, R& k
' q5 P1 H$ G! Z, B- u0 b title="close form">×</span>7 j8 W( d) g( F
<img src="./img/img_avatar.png" alt="avatar" class="avtar">
I% j$ D2 r; Y" r+ u9 O </div>
) y' R1 T: K) k! r' W" ` <!-- information -->
& M+ ]5 ?8 W! _ <div class="container">2 G) m) _! E. B1 L1 r! L
<label><b>UserName</b></label>+ P% |4 Y2 L4 F0 K; p
<input type="text" placeholder="username" class="username" required>
3 A: e, |2 N6 i% [; S <label><b>Password</b></label>
3 \. O1 U" N% ? <input type="password" placeholder="password" class="password" required>
# U, w7 C" J2 U' R <button class="loginButton">Login</button>
. t' z4 T1 @) e+ `3 B <input type="checkbox" checked>Remember Me! w& j5 {& Q$ C% [
</div>
. M' Y6 F5 F/ m2 D* d. b M% s4 T1 o" c) \+ U
<div class="container">3 n& h4 N Y" m
<button class="cancelbutton" type="button"
; j3 h2 _) N: Q6 Z0 X3 E >Cancel</button>
6 X8 f. a6 ]5 w) Y$ k8 u) k <span class="password">Forgot
6 Z V" r& O) c3 N <a href="#">password?</a>3 ]5 p* [, l {8 S" o
</span>
. D1 T, O% c( H. O; v </div> E, T# T s* m5 r4 S, G X
</form>, q, n/ M3 m7 V! m0 J
</div># @8 q5 u+ I# K5 d% A
5 O$ R3 k7 t' u! u" o9 w9 a* L) }
c! c i3 V; x$ x8 f <script>; u6 r, s, g& z5 k. ?
4 g! }$ R; V5 c$ l
function loginForm() {
6 p- B% n8 H: I. |6 m u var formx = document.getElementById("formPanel")
+ S! b% {9 s6 f F formx.style.display = "block"
" q# S* \& ~, T P2 u1 k& w; J }
% Y5 E9 H3 Q) `0 G </script>- N; A* J( m, P. g- k: T
- Q1 J4 E6 Q1 J4 a4 b5 X
* v/ x1 ] h; {+ y V9 l' |( k" o</body>8 e! Y4 ?( B% d: z: g/ e5 |+ b
0 e8 Z2 J1 J- Q3 A2 ?3 D6 F2 R- @</html>[/mw_shl_code]
+ L5 d( X i. L2 `* k! k7 P6 J% p) f8 T$ j5 e/ @' W
; O: Y7 h2 c$ B- D3 Z
注册代码
3 ~8 o f5 S M" [* u; T7 y- v# ]0 }1 |$ B/ i! s
[mw_shl_code=html,true]<html lang="en">, z- s2 \2 W: b, Y8 h
" z9 I# P E! I8 f
<head>
0 g# x8 B8 ?& o; _ y0 f <meta charset="UTF-8">$ _3 N+ ]# e. F# _- y3 Z- M
<meta name="viewport" content="width=device-width, initial-scale=1.0">4 X2 p* ?) ?( j! \# Q
<meta http-equiv="X-UA-Compatible" content="ie=edge">; P7 F) l4 Y. W+ ? W
<title>register form</title>
1 T( D# Y! V) {# z8 n, @1 q+ @: t2 w8 W8 |! ?; K
<style>
. ^8 U' V7 ~2 n9 S& o6 ? .panel {
8 A9 @4 o9 {) e2 @" F, D% k width: 100%;
& C& ~; n. B3 c7 B height: 100%;2 G' [4 A$ s3 r7 P; i( d1 o! h# N, \' W; l
background-color: rgb(0, 0, 0, 0.2);5 `6 F, y& I0 \/ k( Q3 M4 a
padding-top: 30px;
: w" N J. P L* o overflow: auto;4 S# t" }0 V( w, f
position: fixed;* k t8 A) d) y0 d. Q6 F' @1 z
left: 0;, T2 W* ^) ]; B }/ n
right: 0;% a' U* R, U! z0 X! X4 K8 @
z-index: 1;
# n% ~: `+ u) g9 F% i) Y' M }
1 A2 S; `5 I) ^; T
0 u- A: a2 C. j5 S7 D. j .modal-content {
( G) ~" @6 P1 F background: #fefefe;/ W6 p0 j( b) @: `4 Z5 i I6 l
width: 60%;
3 S8 n! ^7 `, Y8 X F/ T( E border: 1px solid #888;
7 H2 g9 W) @6 o margin: 5% auto 25% auto;. [* F" A0 d7 i2 c+ z+ `
$ \$ n- P' O. M( j& k
}: `- h" l9 ]" Y' F6 S: j
% M0 F1 k. e7 A$ k8 q .container {2 x) y/ K2 m; U9 W$ _, @: k& G# Q
padding: 16px;
8 D3 r* V- W. C) Y }. o5 L4 u* ` f' M+ A, q5 \
' \/ \( f- `# N
.close {* X! T; M% n# h$ v) z" ^& } `* E
font-size: 40px;( ], Y# A4 _9 Z
position: absolute;0 c/ Q5 a0 l8 R& z: z) s# u( h9 V6 J
top: 15px;$ T9 M1 x. I; h/ |1 y
right: 20px;
# O1 \+ L/ P+ E+ H$ W+ S3 y }/ i0 b. X$ O+ O) M2 ~# t; Z
) `. M R! W: I
.close:hover,
' x4 M5 I8 W- @ .close:focus {6 B J; V( e/ |+ g3 t
color: red;
1 V8 a! {9 g( m) s cursor: pointer;. @8 o" z* M: V# H* E7 ]* }" v- ]
}% P7 [# N9 t* \+ ]; c) _- k) A
( @. {4 g6 Z; N! z4 ?* V6 |
input[type=text],0 |, I8 C9 A2 t' h* a
input[type=password] {2 T2 z& `8 R* G( I! L' w0 R; C, z
width: 100%;
$ `" i4 ]9 a2 W8 k4 B/ b/ a4 Z( b padding: 12px 20px;. J6 x& A2 m# n( q5 Y( b
margin: 8px auto;% F8 m( N/ j$ y# `# r9 F4 s
border: 1px solid #cccccc;# X- D& q3 ~+ R" s
display: inline-block;
4 H1 X5 o$ h1 r1 p1 H }
5 _ M. C* b: z' E4 x' N
2 ]/ @2 j. }) x# s button {1 M/ O. v! Q1 \" M6 _: _ \
background-color: #4CAF50;3 @9 g" ~" ^, [$ n0 O
color: white;
$ Z' I, g; I9 H* W0 i. P padding: 14px 20px;; r% d& z k# R+ N& w8 A& w( r
margin: 8px 0;0 q; _3 Y2 G B7 Q' u% N, E) N
border: none;
$ X& T# F( R4 A9 A" v cursor: pointer;- a/ l" U, N' k
width: 100%;" R0 G6 e& i4 m5 h' y, a
} z8 u1 O! J5 e) D5 H# H
3 L4 o. k* h$ p/ [' { .cancelbutton {' ?) s" v9 q+ ?2 [2 s: f* u
padding: 14px 20px;! o5 a/ I' h! U# V- \) S0 Z. X
background-color: #f44336;
* Y. _2 d$ q6 ^/ Z& d }
0 z+ }% F# k- k! W
# |7 J! w3 V( B( j& ]: S' N. U$ _ .cancelbutton,
# T) y$ _1 ~4 o; C .registerbutton {& T0 a" N0 p# H+ D8 A% I0 y
float: left;* J6 _8 m. ?& T) ?( L& Z
width: 50%7 Q4 x( `6 h* n8 x6 m
}
$ z; S" a' f5 x4 J: }: v, m% E" i3 O9 C& I
.clearfix::after {
- L5 t0 Y# A( }" j2 k; L( y content: "";
" x2 c/ Y. K* n4 P) A* q clear: both;
i# s% ?6 x- _, X) ^3 R display: table;
. Z' f9 g1 K* B* J: s$ i2 x }
% n& T- Y) B% }* j7 s, i9 x+ g </style>
. |. M$ ~+ Y( r- L2 ]( g+ e/ Q6 p* @
* Q5 g; ~* Y4 S G* Y* a9 Q6 x! V
# N- @/ l; M( v2 f- v; x- U
</head>, I4 _, U: _8 T7 q0 C7 ?5 f
, X1 y& ` b! Z1 J, U<body>: C# W) f: M! Q. @( ` I( m8 M; L
3 ~. }& N6 p0 @4 V x" a+ x <div id="modal" class="panel">: C% ~/ A9 a V9 k& k
<span class="close">x</span>% p+ d$ p4 J U" q
<form action="#" class="modal-content">
% \& I, V! L$ v1 g, S <div class="container">
# n# g" q2 e9 H1 B4 a, \9 a* p <label>Email</label>
0 {8 s- b! A3 A5 }9 Y, E2 I <input type="text" placeholder="Emmail" required>
: C; d) n2 t9 U <label>Username</label>
; h: u8 a- Z6 h1 D7 J <input type="text" placeholder="username" required>4 i* N% u% h% f
<label>password</label>
; x: A9 ^+ S- G' X$ \1 e) L1 l, n <input type="password" placeholder="password" required>
9 j$ h, r+ p5 r) G; @ <input type="checkbox" checked> remember me
# [+ }$ k2 Z) f) T4 K <p>Follow the policy <a href="#">terms & privacy</a></p>
5 Z6 A- f% H& r( P
* @0 i$ Y! E$ n3 w( E* a, O! G* m* w' a9 w( E: }/ c
<div class="clearfix">1 Z& ^ _ R9 N" Y, v4 B! N
<button class="cancelbutton">Cancel</button>
; U! }+ e- Z3 K/ n; k# m <button class="registerbutton">Register</button>5 C8 _' t* Y; c# S0 D9 Y: A) ^: w9 _
</div>; j3 g, m$ V r$ o5 }& [' I
</div>% ?8 Q- B& I3 c) a
</form>5 U8 @! Z B4 f+ |1 H
</div>1 t4 n( y* Y8 X( H( j
9 M. Z& m' v( D: S- u6 C4 {* z3 L }6 \( W. p
% H. C$ m$ ?" ^8 }
: S% w0 Q4 {5 n4 R( S
2 m4 M+ V7 n* B1 f! [5 F+ O3 g
</body>
" Z( d0 s3 y( f! j! J5 ~& A- T# s! L6 u6 ]1 A7 e" [+ w6 H
</html>[/mw_shl_code]
9 l! w+ J) [) r5 D: C9 u: C |
|