|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面4 Z8 c7 Z y5 E* Y
- e" `" c2 ~" u0 a/ S
2 J( T* f- x4 X( }3 p7 ~
登录代码:
, u8 n& I7 I( \2 Z2 f+ g# E
4 w* d' g1 \* Q! |2 L4 q[mw_shl_code=html,true]<html lang="en">
* d4 Z% X5 q+ i8 M+ q" M( J: K' L) R$ K3 T7 U1 {
<head>
( Y3 `0 t3 `3 r <meta charset="UTF-8">
: ?, ]6 m9 k9 A* g3 D <meta name="viewport" content="width=device-width, initial-scale=1.0">' ?9 _2 ^% E e- \6 `
<meta http-equiv="X-UA-Compatible" content="ie=edge">
5 ?5 S4 g3 G- n- v3 @8 v <title>This is a login form</title>8 |. _& ^: `6 ~- F7 ?* f
4 a9 x1 N# n# T9 b <style>% M0 ~% n; E0 v' f4 R6 z- E
.modal {. v! {% g1 [- U; M
display: none;+ m$ ]* |1 g+ a5 W
width: 100%;
1 Y5 v* D3 ^2 |: O# J7 T3 U height: 100%;
+ N) j, H! g4 K; v' a' e position: fixed;
' Q; }+ U3 t) K+ m9 d: w: B overflow: auto;
& l1 J- F3 s, d z-index: 1;3 a4 C( k6 y9 E3 C& \) n2 E! Q
left: 0;
$ `3 h! f- o. J, Q3 Z top: 0;# ^# f/ C% v. f8 H
background-color: rgb(0, 0, 0);
0 k& @; O( ?5 x1 O w /* Fallback color */
$ z$ G, N" m) a" A, H7 U background-color: rgba(0, 0, 0, 0.4);- D9 ^% a4 x# y7 q
/* Black w/ opacity */: H7 t- M9 X4 w
padding-top: 60px;
& {+ p6 _0 o" @4 x# g6 d" {1 r9 d- R( g' i
}
! K1 ^4 G. n3 y [( @6 W* u) S$ J, s) E$ Q$ E( P
.modal-content {5 Q1 b1 C& P! L4 B/ e, [
width: 60%;" i5 T, a6 l w& A. W
background-color: #fefefe;
4 v$ L4 d: Z) F9 [2 B+ Z margin: 5% auto 15% auto;
' j7 P! c5 ]' M' T! G) \" S border: 1px solid #888;* @8 A0 G; S& x$ Z0 J
; E. i* j( _" z; g' R }
; h' u- f0 q$ k4 |7 ]% J
, P7 ~+ M k1 ]) j( w7 y/ O5 }! Y /* The Close Button (x) */7 u! P3 M: m6 V. x R n* k* F
.closeButton {
& e3 a, s% i% v O0 J& A position: absolute;
9 V; `+ O% D) ?5 d right: 25px;
9 R9 H- S" a8 D" K( Q, u' m top: 0;. T+ C& U- C6 U+ j2 t' P! A! c
color: #000;$ g3 ~) d. N3 W3 A8 T
font-size: 35px;
! H" G+ v8 l- o9 T4 y font-weight: bold;
8 B. ^" J' C l5 V! R }
8 D$ R/ E9 F+ H0 m$ R8 }) O
) f& Y0 H. G. m% i/ P .cancelbutton {
$ B! M2 c1 l2 D; w width: auto; d6 R) n4 i. U) u6 H F+ d
padding: 10px 18px;. M# V7 w5 r+ N- \
background-color: #f44336;8 X9 \& z( v4 w5 R; S
}
2 c S: d/ ?/ T |( e$ \6 L! j: g
span.password {. C2 U+ X. Q |; ?' F3 u
float: right;. f* Y0 ~" Y: ?. x; H; [% _6 m; h
padding-top: 16px;8 J* Y( b5 \" |9 C2 Y1 F* P
}2 |( D/ b1 U' L8 B: l5 H5 f
3 |+ w' F: k+ |2 i8 _* c/ C, l& h
.closeButton:hover,
1 }4 L9 C; b, j" C1 o+ P$ J .closeButton:focus {
$ `" d3 f5 r4 |" v5 Z( ~ color: firebrick;
( G5 h: e6 W7 d5 T% w. d! ^ cursor: pointer;
) {6 @/ ^- n# f P& n
a5 N( n: _1 t1 u3 C" B }
" o/ D* @1 j$ O; m; s" C4 ?( ]
$ \, o, o1 V$ G: V/ v4 O2 f1 K+ ~# t( h .imgcontainer {
6 K* j% z) R; j" h3 K o+ L text-align: center; I+ t8 j6 x# j3 c7 w) t
margin: 24px 0 12px 0;
, F0 o% K% x5 B6 ^' @* f position: relative;
- |& Z2 J: u( J& s: d- V+ h( \ }; y% S; G4 [7 d5 Y, a! V) Q4 x7 x
8 ]3 N- ^* g; a0 a9 ^* ]
.avtar {; H% j5 c4 Y# s" J6 G; v9 _
width: 40%;( O, [, S& c% M/ j' Y, f
border-radius: 50%;) \- i' J! u2 C! Q' Q9 K
}
- o3 L( a1 K& ~% p5 I" w, y6 a% u' h- b) [/ B/ M) M; K0 W
.container {
0 Y8 C4 C2 O( w1 z- E4 [* \& D padding: 16px;* d' \4 U3 x. e: b$ c
}
& l: }6 H% Q' }" }0 P! l8 H- z6 d
+ T A* L2 R* a) ? /* Full-width input fields */
7 X2 q$ i/ [) k input[type=text],
$ m; V2 i3 L0 W: b4 G input[type=password] {
1 ^7 c8 k. m: n q* \ width: 100%;% l, H! |0 {& ~; z9 ^$ M7 B
padding: 12px 20px;& _- ]1 t% e) j! X- i X: b1 @7 I& {
margin: 8px 0;/ R7 J; L8 `$ N2 n$ u: j% G
display: inline-block;! ]" @9 D; j% ~; |
border: 1px solid #ccc;
. F: d4 x, P8 Y9 x/ \& q box-sizing: border-box;3 y/ Y0 |2 g) [5 ^ u- j8 M* a
}6 n7 \% d3 @" j6 u& j
/ ?! H; `: J1 T4 o" Q/ f4 }
/* Set a style for all buttons */
( T4 w& W2 l8 O2 J* w button {) n6 z3 B7 A# `9 o* i* K
background-color: #4CAF50;4 _2 f2 S9 j5 j+ }! ^7 s: L; ~2 O+ g5 L
color: white;5 _5 E. _2 A7 R6 ?* \
padding: 14px 20px;
& }( e0 x& ~' F0 G: y/ l margin: 8px 0;9 {, H7 t" X# C& V" Z& ?1 b
border: none;& _1 U2 a! a+ V
cursor: pointer;
, _% u: Q0 w! l5 M( f q u width: 100%;
6 P1 @$ t+ H& f+ p% o! t, b' u }
! ?3 W/ {- Q, ]+ X
4 a' W+ J$ N8 D# I* V8 J# ~1 o
2 X* Z/ e0 t( p1 y0 a button:hover {7 b8 l3 e% @# O# S
opacity: 0.8;
" W: s0 h! J- ]( D0 {% [1 f M }
/ A/ s7 J; i$ q+ c, f* e7 G( Z' V0 F
/* Add Zoom Animation */
* k$ o* J3 N$ a! P8 Z .animate {/ |; q/ b. l- E1 b8 I7 ]2 O" m
-webkit-animation: animatezoom 0.6s;
" T3 O' _- {+ M# `: A animation: animatezoom 0.6s
* L7 D/ o3 [+ ^5 r i( \ }
6 p* U; H; T0 ~" Q6 \
' b7 Z5 r5 t* L% I X9 L) m @-webkit-keyframes animatezoom {
/ ?- x7 _! ]) J1 }. e( g2 E from {
# \9 d6 i* c3 R! X0 i -webkit-transform: scale(0)1 t) I8 ?' v1 h$ J
}
. C, I- l) m/ m" T# z% M9 q/ ~7 p
to {
/ d/ i2 K1 H3 o8 P G1 B1 g -webkit-transform: scale(1)
- i" l/ \- p6 n6 S& O }
2 n I# |5 c" g }0 e: ?- o$ [. z! G/ ?3 R
: P0 d) V# i$ R# r. c" T! \
@keyframes animatezoom {% ~! h1 r( H, v
from {
' g( O' s( J* T" x2 m' C1 ? transform: scale(0)6 l( z" {, ^7 D. K f' ^
}; b% N& ]+ u& v6 N) G
7 S- w/ D m8 O
to {) k4 W3 f7 c: S$ S
transform: scale(1)9 b! ?1 S3 U- N+ `
}
1 {/ H R* r2 e2 X3 M4 I0 U# R8 j( R }
7 Z* A7 l" H# f7 R /* Change styles for span and cancel button on extra small screens */
0 b3 H) R% X6 i: i# n% @ @media screen and (max-width: 300px) {! v3 @ X8 O$ F4 h& c
span.password {
# V6 v, \& Q% B5 ?7 s9 I$ B display: block;
$ u, H! I7 ^9 V' u float: none;0 Q: E' x9 w. G! k
}
5 C# m+ B7 _7 Z2 w
! J% ^. i. O2 a4 V; b) q( Q1 F* P .cancelbutton {2 Y! _- L- V) t1 J0 h- U
width: 100%;6 j0 i& e3 N+ j* v R4 x4 `
}
) R! {; e) H5 N0 B }/ J! ~! e3 g7 w" w" c2 a. E
</style>* a" F% e: w2 m4 h9 e
</head>+ G; K- v5 `# v5 O C
' O$ k1 P) x! e5 L8 h5 C5 h( M<body>
. y: }: V6 V0 F1 [0 \, X% ]8 A/ X# N$ e9 D% x! X# Q
<button id="login">login</button>% Z4 w6 p- `% _. e% L% w7 I3 ?! ~
<button id="register">register</button>
' k5 U; N3 s* \% [7 h) J0 P; _& z; |- ?3 W! \$ c
<div id="formPanel" class="modal">$ }' i H+ W9 R* L2 i
<form action="./img/logo.png" class="modal-content animate">
" o* P9 F3 S% b2 }7 \. u <!-- image -->
) a: P9 T9 G1 k7 A <div class="imgcontainer">
* L/ h, _9 U6 j <span id="closeButton" class="closeButton"
* m3 ^ O* F4 V( Z% i . Z. E% ^! K9 t0 J0 W
title="close form">×</span>
4 O, z* G2 n! K! s3 e4 f* e6 M5 H <img src="./img/img_avatar.png" alt="avatar" class="avtar">0 s+ i3 q& ?2 N/ @
</div>$ O6 Z# _6 d& T2 F0 k
<!-- information -->' G9 c# q- w7 T; Z& w/ _# [: @
<div class="container">
+ `) f6 Z7 G0 \ <label><b>UserName</b></label>( \* e) E7 g8 N5 m- I
<input type="text" placeholder="username" class="username" required>' p/ f: H5 u9 A, ]& v( d0 @
<label><b>Password</b></label>
$ k$ H6 |. w0 h* }2 E2 T6 B <input type="password" placeholder="password" class="password" required>
( d" t* K* d. B7 ?/ B <button class="loginButton">Login</button>
$ H% N0 A- ]' v, I; \* i, p/ n; m <input type="checkbox" checked>Remember Me
6 R5 j! k7 d& r% x0 o+ o$ } </div>3 A x V2 w9 Q" \6 N; ?
% I4 J, R$ Y5 B1 k
<div class="container">
+ u4 x7 U' s- E9 I: @! o6 ?! b <button class="cancelbutton" type="button"
( g; g( _/ G) w7 I# a% \3 Q >Cancel</button>' F i' @# `/ l& W7 [3 m# D4 O8 b
<span class="password">Forgot
# Q; z3 H- j) m6 |4 e4 w <a href="#">password?</a>
5 U2 K& W1 u: l5 t0 B6 F9 r7 D8 F: V7 ~ z </span>9 S; c) i( }$ Y( W
</div>
, @& w9 k$ O$ V: [! F% ^1 q3 ~ </form>
/ b2 M( l6 |' K </div>6 _6 |' { {5 p
) b# I4 Y( z. I3 N, Y4 ?4 h% l7 P( k
<script>
. z* B8 [9 |% C# I( z% Q+ P% d4 L4 i. q6 n$ ^6 x
function loginForm() {
& W( y+ c7 S5 K: {5 q var formx = document.getElementById("formPanel")
% j. T0 ]. x x8 ?" C% j& v) w formx.style.display = "block"1 S0 a- A: _ o6 r/ k+ w) m
}! G! K+ |% Z( I( g0 l+ V g- L
</script>3 P; {5 v* C( z0 v+ b B9 f
6 K% p+ {1 c; w/ b* f2 C
6 q5 Y {; R/ u+ c</body># U1 `( h$ {4 e5 k8 [. v7 q% S# T0 ?
! e5 f& [7 e% U</html>[/mw_shl_code]+ X3 t8 z; b9 ^) Y9 P3 L3 {& f! E
8 _' {$ x5 Z( B% [8 G' L( f7 C) `) F2 ?3 p' F
注册代码5 e& x' Z, z7 K' z2 Y
6 `3 S0 f% L+ U+ r& r% l! \6 h
[mw_shl_code=html,true]<html lang="en">1 }+ N- l; i' U/ ` m
9 O$ {" k o. _6 K
<head>3 u* }) B3 ^. J! T. v( y
<meta charset="UTF-8">- y( c' J7 D0 k
<meta name="viewport" content="width=device-width, initial-scale=1.0">6 V2 u" \# y" w4 \* W Y: { w- U
<meta http-equiv="X-UA-Compatible" content="ie=edge">7 S; w; n$ _' o% Z+ @
<title>register form</title>: d0 o8 H+ ^+ m" b& I/ _& i9 A8 u
2 z3 w& l8 j2 a8 d
<style>$ F7 u+ L! R, Z, f, Y& ?4 \
.panel {
7 c& m& g, r1 m# r5 Y5 A' N width: 100%;: K, o2 I3 t$ x9 L
height: 100%;# ]" H9 |) Y: `2 M
background-color: rgb(0, 0, 0, 0.2);
) _% q% [+ V- ~" R/ d padding-top: 30px;7 P6 B9 G2 k! g) N% d3 C9 h4 ]
overflow: auto;5 t0 o8 ?& _: B
position: fixed;
- `. a T# d' v: k" M- [0 W left: 0;
9 i& _$ x7 G: i* k$ K9 y4 ?( ^ right: 0;
6 b) F3 [( D$ X/ ^+ k! h. K z-index: 1;0 |8 I# e, z: M1 x
}/ g7 Y; Q ~0 U5 t/ G* Z1 l
! _' a8 ]$ j4 s& T, m .modal-content {4 f& R V- }$ I/ }9 ^* i& Q
background: #fefefe;2 u. |& }( K$ R* I1 X% Z, i% M+ F* y
width: 60%;. n; }$ L7 o! g+ L3 W. {5 `5 v4 a \
border: 1px solid #888;# C( X8 O; A/ l# q8 B8 }& o
margin: 5% auto 25% auto;9 m4 x9 P h% i0 ^3 E+ l5 J/ P
; Y7 a) j x- I. w# p, N4 ~" t
}* w" w0 U4 G0 S1 ^8 D
' L6 W. k" N( R3 e2 H) ~; o1 v/ E
.container {8 i/ B' y" E* u0 I) x
padding: 16px;2 _+ X; Q9 `( `7 D7 ?( \
}
}) w$ s! c3 w# o; w4 {1 |" g$ x
.close {
" ?* F, m( p+ b7 C font-size: 40px;# d" o& }/ N- M% `% |" b8 X
position: absolute;
0 O* k/ e* ]# B" l+ U, {- R0 P top: 15px;
$ e% E7 U: P e/ @4 \ right: 20px;& J6 s& i: s0 G$ r1 C. y
}# R3 b! T7 F2 Y3 k& P! R4 y
( N) F: v. t# q8 d' R .close:hover,
8 x8 m* _7 S$ g D" d4 I! v .close:focus {$ J6 ?1 |) n8 k! G: r
color: red;
3 E8 o( f& N2 ` L, J) p8 d5 G cursor: pointer;
( a9 @2 \7 ^+ a, v }' c, R. k1 G; _% h; `
- v; `+ g5 d" G: l K& ^ input[type=text],
3 d5 ^. v2 i4 }, x. Y8 U input[type=password] {6 J6 _) x! X7 v8 T% r9 J3 P" V
width: 100%;
+ _2 L2 l7 W- F5 G padding: 12px 20px;9 r& `1 U4 B/ M9 O1 ]7 K- w
margin: 8px auto;
) H1 k' A8 g" a9 U0 v7 l2 K% f border: 1px solid #cccccc;
; v) Z2 z& T. v- U) ~% q8 T display: inline-block; `. x6 O& i& u% G9 o$ g" n
}2 Q5 `5 s! X* q. m; p- m
2 C, J, }: s# ~" A+ A* M# g" r
button {
. }, G' G6 W; F. F3 E3 t' \. \ background-color: #4CAF50;" K6 V4 L0 a; d/ L: z8 t
color: white;
9 e: d9 S7 h5 N% } padding: 14px 20px;
7 h6 t8 H4 v, b: _% p2 i. d margin: 8px 0;
# J" ~6 V3 L$ B border: none;
0 H* T9 c* B( f: H) I cursor: pointer;
( u- V$ U! d& e width: 100%;
6 ?# [) Y3 {$ t6 l% k }! B* ~6 S' Z" ]& s9 j+ K9 w
: e6 l4 r2 n& @5 g# s
.cancelbutton {$ r$ W: n9 U. Z& f9 A; E6 S8 k, g
padding: 14px 20px;/ `8 h1 E* ^6 m4 t& C
background-color: #f44336;" C( K7 O/ F3 A$ O( I5 @+ A
}# p- N! w( T5 d. G k: ?* I3 E
0 b0 `/ P, q7 ?7 z% k) C' [1 @+ Q; p
.cancelbutton,
- B+ `- c( n9 e3 f# v) Q$ C .registerbutton {$ G) y) Z( f& [; k
float: left;
2 d8 z, b: v7 |2 { width: 50%- U2 ?6 {& c# _$ y
} t6 K4 U4 c8 m7 y+ n0 H
7 o: U1 H1 j& F1 L3 G7 x: y
.clearfix::after {
; l5 z0 V0 ~, l2 S, @+ W5 |! M content: "";# m5 m- \3 I# C' r& }* g# F% D
clear: both;
$ E9 G( P2 K4 \, o" _9 B3 S* V display: table;# a/ k: H* A: j
}: b. o9 B. t1 i" I3 F0 ~ E6 O2 B
</style>
* s: S# N) l3 X+ N7 o' J6 X* ] G$ R6 _( ~1 J @" ^: ?
0 z+ Z* ]& S$ g# f' R1 T! h
! |+ r2 b, n5 D. V</head>
4 m: U a) R/ ?) u- _- X$ P( a* V/ x3 z2 m! |, z& o+ @; x
<body>
2 }2 _/ k3 g8 v5 U9 K. N/ x7 `! I( K: A( k, Y
<div id="modal" class="panel">
9 Q% v% S$ @8 n! z+ W T <span class="close">x</span>
& l/ O$ _9 W/ r, w <form action="#" class="modal-content">% Q8 r0 c: g, F
<div class="container">
" B+ q; F* K7 ]; ]5 j <label>Email</label>
8 ?! n! W3 s( k8 a <input type="text" placeholder="Emmail" required>
- P- W7 q: B( G5 J9 I$ n$ h) ^ <label>Username</label># O' Z/ h4 ?/ l! e
<input type="text" placeholder="username" required>
0 Y2 P( t3 ]. d2 \4 l <label>password</label>8 T. ~1 S+ E9 z* O/ E6 ~1 n/ ~3 h
<input type="password" placeholder="password" required>$ P. ?- o3 c4 b* V3 A- [9 I9 Q
<input type="checkbox" checked> remember me/ {" Q" }$ p J! N- q3 }2 v
<p>Follow the policy <a href="#">terms & privacy</a></p>
. Z& I" r# \, t% A* ]
4 c% ~% C# P% @9 g$ f7 j- f* \8 Z6 a/ i% d4 t, D9 k' z: I! A8 G' r$ K
<div class="clearfix">
+ x2 z4 P C8 v5 M3 `" F2 @+ A <button class="cancelbutton">Cancel</button>8 }7 e2 n6 N" k, z8 ^" k
<button class="registerbutton">Register</button>
g% K4 x, ~4 K4 u </div>
8 b c" Q3 u2 n3 g& [9 u% c* w </div>
' d5 d, m% j+ D( {: d, g: n6 D7 h </form>
* [: F; W& T# v+ B1 C$ [3 N </div>
9 L; ?# G1 ?; X; B2 j! A( r- \3 ^! O/ O; G
$ b& @! m9 [2 m. u! E
4 M) p9 e& P1 ]7 L
* ~3 q# ~2 H2 a+ f) k& H( w
; O) E6 B2 X4 A2 o+ ^</body>4 G' P2 o- p! g( q% R- ]: `
5 Q1 Z1 A9 w& _4 {3 {0 |
</html>[/mw_shl_code]
6 K$ W3 ^5 E5 T4 H |
|