|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
0 Y2 X: c. g m: F9 H: M8 @' w
q; s1 \. U) \6 n' N5 m
+ r S: c; G% m4 J- m* e2 X登录代码:& {* X6 X# T& L$ H1 q" T" F
( i6 U& c# p5 ^
[mw_shl_code=html,true]<html lang="en">1 c5 x; W) i2 [+ L. S! T" A
, M7 s9 r I6 V: T w7 ^; \0 ?: G6 R
<head># W- Z+ M* H+ p6 _) s& W# I
<meta charset="UTF-8">) V9 k) X( z" v0 q( Q% h
<meta name="viewport" content="width=device-width, initial-scale=1.0">! x+ x2 D2 I# L4 }9 K; x
<meta http-equiv="X-UA-Compatible" content="ie=edge">- ]+ g+ ^, {8 b! ^$ ~, h+ G4 z% [
<title>This is a login form</title>
( k/ l1 c2 Q/ T2 r$ x" ?0 b
) [9 ~! K3 s, ]* \1 [ <style>9 o1 `/ Q0 }2 p! I0 L
.modal {
( U: d5 H) \1 `8 c9 y9 Z; @ display: none;
/ O5 ]1 i9 t, ]) X t width: 100%;
% d L4 a9 @6 H( d height: 100%;6 w% H3 b; P7 K
position: fixed;
! Q0 d" ?$ f9 N2 g) G) b! m overflow: auto;
8 i" x' E1 y7 w' _7 g z-index: 1;' M1 t/ Z2 V' j) |) i$ _+ I
left: 0;
7 @8 P& \2 z" @, d4 U2 n top: 0;& ~& h2 m; {$ d: _* `) Y4 L
background-color: rgb(0, 0, 0);/ B0 s1 a9 v1 z& N% R/ G% v8 B
/* Fallback color */) m3 i. y' b* t7 I5 e
background-color: rgba(0, 0, 0, 0.4);
1 \4 k; `6 L- A F' D% X" C. } /* Black w/ opacity */* W# l: @4 y% C1 c. B, |& \
padding-top: 60px;
9 R6 b# @1 c8 e/ S( `6 E2 L' b5 D. b: ^+ L/ V& |" L$ t
}- J( d: r) H8 C, {; z/ V7 Z4 c6 A
. ?) v8 d; v9 }3 g$ o$ b8 t8 c/ Y .modal-content {
$ ]: \$ l- Q8 D4 E5 H6 K/ h6 |) X width: 60%;* v; j8 U! ?5 F! b
background-color: #fefefe;
2 s n, O' K. V2 ^2 Y2 N0 S margin: 5% auto 15% auto;5 T. [1 M, ` F B' ]
border: 1px solid #888;
$ O- V( T5 j, p" E5 _8 x
w$ o. s7 M& U8 z c; [ }
6 N; V7 B. k: u# \! {
6 W0 ?" M- U" G N /* The Close Button (x) */ T# S- ]7 C" F0 V8 K! k
.closeButton {
6 N4 b6 Z# p3 A1 {% A4 ~, a7 o position: absolute;
" ^7 n9 g( H8 D$ L right: 25px;& k* w$ X# n% E- _! Z7 g0 Q
top: 0;
" K6 N' C( n- v8 n+ C; f+ z color: #000;9 F/ `; N& i2 T2 O
font-size: 35px;
+ C2 N' S8 z1 x( o. g# i! p" \ font-weight: bold;
! P2 W! @& ~3 x% Z3 P } E1 K# N) b, @. W8 _
7 \( G$ q% P2 d& v- a) d$ M0 c .cancelbutton {- D" ]* t. `0 E6 n6 o4 g
width: auto;
, o) g* i0 a R# u2 ]& o: Y padding: 10px 18px;" ?/ z0 |. a9 c: x0 y
background-color: #f44336;: d/ K5 l* ]* i$ c/ y7 @
}# O- t# J/ a' b" r
! M; p! X& a0 G$ y' B4 j1 P* ?
span.password {
3 M* P* v# H4 G2 w7 v float: right;
" x; T+ z ]" m/ t padding-top: 16px;
# ~6 N6 A+ N( w1 K1 h9 N! B }
|, p) n7 x8 T9 Y+ B8 ]
1 q. Q0 F- J Z7 g6 {6 u, n .closeButton:hover,. i9 o3 l* x( i
.closeButton:focus {2 s Z! V0 G5 M: h# x. @4 M% o$ s& T
color: firebrick;- _8 r: } x8 T, x( \, |; Q9 n! a
cursor: pointer;/ G8 O3 I+ K1 X5 Y
, I9 J2 g/ ~3 w9 w8 A4 t }! v9 R: \5 x* w: T6 {" |) E
3 Z& a# v8 `- \0 t$ \" M
.imgcontainer {2 c+ \& l7 U& e- `- C/ h
text-align: center;
' e5 K. `3 h. ^5 m) O/ A7 s3 k margin: 24px 0 12px 0;( `9 I i: F& A& Y3 T% f! h
position: relative;
( N: I- L1 h" l8 d/ C- v2 ~( L }1 ?9 s8 w' E3 _) X9 Z" ?
+ p& g3 g( J6 s, c3 R# p7 }4 E .avtar {* U; e8 k$ J! F7 O$ D% ] b
width: 40%;
8 P x2 W! T/ {. U# V( \ border-radius: 50%;
# @. l d B% a' e3 u }+ d9 i; J( w# y" D- H7 M
\8 h1 g6 E, k6 V, M: n9 U! W
.container {& ?& R. R( U4 h" U
padding: 16px;" @1 f% r1 `5 J1 j4 Q! @
}0 d/ v/ C7 a6 ^; G$ E3 R8 w7 I* B
5 x. r; C& s9 m y% ^ /* Full-width input fields */
8 d. e# E& i4 ]6 Y- n) L% p5 U5 F- i input[type=text],) I. \7 ~( r" J) Q. `$ m r6 }9 P
input[type=password] {1 X. S8 f# J; @6 o
width: 100%;* ^0 Q8 {2 | U9 O9 F- H6 E$ Q/ {
padding: 12px 20px;
% e; t2 I% Q& o0 ~; Z# } margin: 8px 0;
+ U& v$ e! g5 x- x8 M display: inline-block;3 C: l8 D- m6 x& u, @& u5 |
border: 1px solid #ccc;
/ G5 g9 I- c7 v9 E h box-sizing: border-box;
9 R' v8 H( ~! A% v1 J }2 G, G2 B( ] b9 i* W4 `
2 |' |# n+ y5 q0 @; @, @ /* Set a style for all buttons */
8 H' M$ S( P8 n+ v button {2 m' e* ^6 M" @. Y3 Q+ h3 T$ q
background-color: #4CAF50;2 k* b/ N1 M* {" l$ k8 h! J
color: white;
: o8 P7 E# i5 |; v: m3 Q/ X/ g5 j; C padding: 14px 20px;
1 l% G; d/ Z) N9 H* [ margin: 8px 0;) n( z, F5 n: l# V3 g* \5 Z
border: none;
/ N, [5 Q& o5 ~3 T, X2 ?: u cursor: pointer;+ U" z" x! Q! M7 v) c
width: 100%;- @/ x% N% i9 D" S j
}. [( Z/ X9 ~! t3 k
$ U/ N# R- e, S( V; n% D9 q G. s" H! Q1 N6 n
button:hover {. F! b) s! e6 b0 s4 d) J
opacity: 0.8;
0 `, d( c1 k n( ^- G% v }
4 R7 @' g- W# k3 u4 u/ ?9 F
$ J/ F) t' N! ?" [, g /* Add Zoom Animation */2 C! F5 Z8 U9 N/ u2 l+ T* e( S
.animate {+ R8 ^2 r# \3 \6 d+ K+ M; z
-webkit-animation: animatezoom 0.6s; r6 w4 i/ x$ f+ @
animation: animatezoom 0.6s# b5 w4 y2 d) d% a6 V
}" {9 i% e) [4 \5 ^7 g
3 P# P! s- z7 x
@-webkit-keyframes animatezoom {
6 G( B8 ]' ^+ E9 d from {
8 {# {6 A% R, a& f9 G -webkit-transform: scale(0)
0 |) m- h' j+ a+ d* m& r8 Z( ?) d }
& f1 j" V, n1 \ L$ S3 s# Z$ L" V7 N1 ?% o& u
to {; d1 v9 f5 V/ {8 u& A/ _% |7 q
-webkit-transform: scale(1)) Z1 b) `% v- H! K5 U# @
}) q: w+ H$ k$ h1 j5 @" G- X
}7 S/ l/ i$ v' {# l1 N
! o( s9 W% B( X# ^- p$ c @keyframes animatezoom {" @& i" L. }+ J8 z8 @' N& j
from {1 z% q. S) p' s6 _/ B9 R8 L
transform: scale(0)
6 @' g; i/ l* q. |0 G4 _ }- Z# n7 f' ~1 m4 g: N( k+ q( Y
8 r3 H- r# O9 ?/ i
to {& _7 i) n* C8 c& R: B
transform: scale(1)" p1 M' y( Y, u+ i( M: r& B
}
; y" W' c) Z) |. V }
/ T6 h& T. {5 E3 W! G& A /* Change styles for span and cancel button on extra small screens */1 D9 y# l* `3 v" |
@media screen and (max-width: 300px) {
# E+ Y. C+ j2 Q* L% O& z span.password {$ ]$ t7 g: W9 d @: h: d
display: block;8 J" t# N5 z$ @, V- {* ]
float: none;
( V, S0 ~) R" D }
" N/ N$ i3 U' ~$ x% x" G/ V$ a, B; V6 c& N4 L$ ^6 o
.cancelbutton {7 h6 p1 B: Y2 c8 v6 `" ^
width: 100%;
* t' x1 q' h: f' R" E# x/ M+ r }1 g K4 s4 L: S0 A* V
}
3 Y6 J. c: F0 V( U% ^. T& A </style>4 ~4 k' s% I0 L# D' }! Q3 ^8 d: P3 P
</head>
_: r S7 J2 y& t5 E- Q; W
% S _, H1 H) a2 X<body>% q4 j: ?4 e$ `, m6 a2 y; C
0 r. X _- \4 L2 q, I, _
<button id="login">login</button>
/ N: j! s% N. b5 a6 `0 t6 N5 z <button id="register">register</button>) I8 [* e {) U* [
. q/ U, P: q1 I7 c3 \ <div id="formPanel" class="modal">
/ R' V; z" T$ h& N4 f <form action="./img/logo.png" class="modal-content animate">' [( a! v( T- }. }! F, d
<!-- image -->
. |% v2 C7 P% x: [7 w5 [9 ~* Y" j- y <div class="imgcontainer">
6 O- }# X3 K7 k4 B) j3 o/ B3 g <span id="closeButton" class="closeButton"
3 X6 d; u4 a3 [8 L* } L0 ]( R 3 [; j, _8 a! K8 g) g
title="close form">×</span>* _$ E( r) }" b& {7 w# g5 q
<img src="./img/img_avatar.png" alt="avatar" class="avtar">
5 t4 V$ d$ {) x6 }3 u& k1 ] </div>& U8 v0 G* r' \* j+ N
<!-- information -->" s! d) Q7 O* \/ `( C
<div class="container">
" c. B. `! A6 A! P2 I' ~0 h <label><b>UserName</b></label>
2 f k! `' b( x' J+ j1 U: U <input type="text" placeholder="username" class="username" required>
' q' h w1 u. x4 P <label><b>Password</b></label>
& Y+ q$ g# l* V- P; u <input type="password" placeholder="password" class="password" required>
2 o8 `* O8 l# D4 ? N <button class="loginButton">Login</button>
. N2 W; g; L, E <input type="checkbox" checked>Remember Me
5 Q+ `/ r( H) y' F; R </div>) D/ Q3 m4 _ @2 c- J( c
6 X7 F/ _8 o* \' {5 ?" [" i7 B. ~ <div class="container">
2 b% d. u- M) M# `% L <button class="cancelbutton" type="button"6 t$ w8 Q4 x9 S* v' H) h+ B- e
>Cancel</button>
, x/ D& F. B8 k' m <span class="password">Forgot: w1 E1 o) m: N3 k& p- ~# L. a1 l
<a href="#">password?</a>) r. o3 L* ]% `- D+ {2 D! Q6 \6 G
</span>" J. ?) z9 B' d% |7 i8 c
</div>; ^ l8 _( P7 V, `
</form>5 s1 R m* U! H: m
</div>! i9 m8 r! _$ E
$ ]- z) x" [' k: I
$ D$ ?+ B2 n2 Z, b% L! ~- ~" M <script>, c7 i- S& ^9 \3 A! q9 A! R) f& `
# A4 w' g% u# {, l& U6 T. v function loginForm() {
* P) X8 C6 q9 z( G: v, q var formx = document.getElementById("formPanel")( v- ~& o# t/ B, ?5 h4 P
formx.style.display = "block"( j) v. q+ o$ U: R
}6 N# x8 g$ A& X" y# u
</script>" R: d5 ]3 N/ K/ D, l& }" p
3 B; Y) C. B9 ^4 V& _5 G7 b
, }' U, O3 B) p1 f1 s</body>/ j: R( l4 k# H: E! T2 Y6 D0 m
5 k; C9 Y% x) M" y t% f& m1 s</html>[/mw_shl_code]* i9 }- A- \4 x' E1 ]& ~# Q
8 I0 d9 `) L5 w& e( d2 C) c5 O& D- {
注册代码
3 T W8 y4 G( ]# X0 N% j0 L @" p* k, P
[mw_shl_code=html,true]<html lang="en"> x2 S6 v/ U" R( Z
( y: A* A9 ~3 `2 c M/ G<head>; G. {1 K5 T+ M3 ?; ^! z
<meta charset="UTF-8">
6 |; n# }4 i2 E8 P& E9 i <meta name="viewport" content="width=device-width, initial-scale=1.0">
) V; T- c* B, p% J2 f* I( { <meta http-equiv="X-UA-Compatible" content="ie=edge">. l8 G* E4 V7 S7 F5 ^( l2 H$ J
<title>register form</title>7 N+ T$ S/ u* f% {
; n! a. G" g9 E$ p9 h& Y% q <style>
" c! d' j+ F$ Z: B! k0 d. i .panel {) O) E" K, M: T( W1 m0 h1 i1 @& F6 K
width: 100%;& H5 d" H! g) Y1 J3 t& r. w
height: 100%;
. |1 o5 Z0 t# I. A0 v3 W% M background-color: rgb(0, 0, 0, 0.2);% R$ u( t, H) o' g, H
padding-top: 30px;/ i) _. V- Q' J( J) O- C# J
overflow: auto;" {( f5 s' B8 c- I X0 \
position: fixed;5 _3 h$ Z& U5 y+ n ?, H: b
left: 0;# i$ b0 \0 u. o
right: 0;- n% c1 y e3 e( R- ]$ a% Y) }+ S
z-index: 1;
; y8 j+ ?* x0 h0 L' n } o/ Y& z4 R3 Y# P
1 x0 m9 J: m6 K' i8 G0 x) r
.modal-content {9 h/ H) ]4 n6 T. E7 A f
background: #fefefe;
/ L; V. g1 Y9 T) J width: 60%;
- j$ _, ]$ @% n: X border: 1px solid #888;
/ i& B) `0 U( K9 r( i8 J margin: 5% auto 25% auto;
) E0 W+ c7 b6 Y. W; d' Z
. R( ]$ j( u( y# b0 u6 ?+ _2 ^: j }$ t5 M& H3 s5 b8 N6 a
& D0 p: F4 U+ q( F, {- p# \ .container {
0 G. v! V! P: P padding: 16px;( P' P5 ~3 `( r" ^& J) T
}
% Y# f& x; y' G9 ]
- S! E! p" O) {1 X: O6 m! k* N .close {9 L- g9 Q' I. O; h1 V/ u+ r
font-size: 40px;
2 A3 R% p( x1 c& a6 x n+ t; }6 n position: absolute;
. @- Q# {1 \% ]4 U0 y' @) q top: 15px;
$ h5 `0 M. d2 _ right: 20px;5 ] O3 j1 v3 C
}
1 l6 L3 k# v% G5 @2 N+ K3 a3 B
2 I" _, o1 z4 F .close:hover,
! Y5 k3 h/ E3 Y .close:focus {( s' k- ?) L1 k! }: Z h
color: red;; P) S1 K4 v# o1 W
cursor: pointer;4 E* j: b Z8 o- n+ A2 p5 ^
}
1 O0 E6 f' v8 r# v5 w
# K& d0 v0 n$ l' j0 d, q) d) e input[type=text],+ j0 K; K+ O4 C! u$ B
input[type=password] {* d, u3 H$ k! [; \
width: 100%;
2 ~- O" i! O, I+ Z* J9 d padding: 12px 20px;- |" Y5 j+ L8 D1 Q2 @- X
margin: 8px auto;
, ?+ H. l# k( P& R0 S border: 1px solid #cccccc;* Q) t7 B; ^ k8 B% W, ~, q
display: inline-block;4 Z3 t$ A5 i- p1 f& U
}
8 w" J9 H; Q6 v8 T" u$ e H0 z' t
2 W4 M. {$ M( G button {
0 _% j* y X% _ background-color: #4CAF50;5 S1 P9 r$ _2 ^, v* V
color: white;
' p( `( j0 C F2 v' m7 [; l4 {1 N padding: 14px 20px;; t' v! X: t* l# G5 q
margin: 8px 0;6 [* N; z! ?2 G5 r' S; K
border: none;( W; f* k; i; y# T% }2 v
cursor: pointer;3 l/ @, Q1 ]" W+ y/ @0 {, b" k
width: 100%;
" B% A$ K; c' v" Q1 B: O+ }: b }
4 @+ T0 ~7 I/ k+ ~) @+ ?' V$ O, J
8 ^: t! H& a9 B1 }1 Y .cancelbutton {
9 x O6 u, V' s padding: 14px 20px;
+ C" r2 i( P; n% l4 u3 U7 q background-color: #f44336;. S! k/ Z: m1 \4 m. ?
}
9 k5 p4 n( o1 c
4 s. \4 b) i$ Q. X. j0 | .cancelbutton,, f; r8 h( u/ v: P
.registerbutton {% N& G7 H; I- T; j, ^7 H# {7 A
float: left;
: } {$ _. r8 o width: 50%; s3 a& C, G% l! ~: T7 A
}& o& ]- G }; A9 M5 Q
! ?, U# N8 n) ^9 B% a7 e
.clearfix::after {
2 s+ b6 Z' ~' U$ e. _8 } content: "";9 S/ ^! S% O, i! z. |/ L2 N
clear: both;% \0 M: a7 s- X$ W: o" K2 \0 ^
display: table;
% h$ T! g& b' l! B! J9 c- Y }
f- [# g9 x, U+ ] </style>
7 p; K1 ~2 j2 l; N, e1 L8 T& d$ E- n+ @) U+ K
( Y' F: G6 X4 ?
0 F4 S, @$ K1 b$ F; z</head>% C" Y8 y* Q* y- s* d9 `( |
+ m0 r* a# J0 v7 h; h& P<body>
0 x$ ^; z8 r3 T7 \" k/ s" H7 s, e& B" V( b$ c
<div id="modal" class="panel">. U2 H w# |# w$ A. r" D
<span class="close">x</span>
. u. W* I+ E5 A7 |+ G5 }7 I <form action="#" class="modal-content">
0 x w! F7 i" I: O* E5 ?9 a <div class="container">
5 z8 e' h8 X! _+ ]6 c. q T* W$ d <label>Email</label>
1 f3 a1 G4 a7 p/ F5 {3 y <input type="text" placeholder="Emmail" required>: t+ m2 X% T0 n. t- ^- e5 A8 d
<label>Username</label>" n: U# R7 S) C
<input type="text" placeholder="username" required>0 X, e. C: K) e# p: Y9 c6 `8 Y
<label>password</label>% x8 r" X/ ~- F. a; H5 P
<input type="password" placeholder="password" required>
- w5 d7 n( n1 Y8 }0 B b8 O% [ <input type="checkbox" checked> remember me* S) t+ ~8 ?2 k s
<p>Follow the policy <a href="#">terms & privacy</a></p>
" j7 X" ~: n" O( [& Y" U" E( b; [7 j# A
: S/ d: V3 U" f1 f4 O) g
<div class="clearfix">
: B. C. F, g- n4 ~ <button class="cancelbutton">Cancel</button>4 p* \4 D1 m+ o" `4 e
<button class="registerbutton">Register</button>
$ Q1 B5 K B ? </div>
0 O+ K7 e! J% p! n$ ?6 ^6 `: @' | </div>5 r# D1 L) i* ?6 ?# i+ E% Y
</form>
" u- J( K( o, c </div>
: l# e0 A# I6 h( _" q) W" E1 \( t# h) o }& t) A
! }; v. r, j% |5 I/ S- }
) X& i; c1 Z% _0 k
! d0 ]8 Z9 D7 `$ H3 P$ F6 q8 ]: ^% D
</body>
% f4 ]9 t9 m9 u: }9 H% B: J; \# V# ~8 W' E1 ~& g H1 |
</html>[/mw_shl_code] O4 q$ s" B3 v8 v, D& G$ h5 C* P5 Y
|
|