|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
8 B0 F4 j! z% ?% l8 t* d* }+ W4 G- g$ ~; Y% C) q
5 a" j5 U) n* J( M1 l+ d% E
登录代码:
' H" B. e; Y! C. k) l- W) w
1 N% f3 J ~" {5 K/ U! S[mw_shl_code=html,true]<html lang="en">$ Z$ o9 w1 |; G2 ^" k" c
( N" _. d3 s9 m. A) j% k- M' H* V<head>
5 S' e. O/ n5 C4 Q7 F+ g$ t <meta charset="UTF-8">
/ \0 [, S& A6 C2 O+ }2 T/ @* g3 T: y <meta name="viewport" content="width=device-width, initial-scale=1.0">
2 `. \4 d: m$ G <meta http-equiv="X-UA-Compatible" content="ie=edge">
! m, p% h: J$ L Z <title>This is a login form</title>; p: i% f5 {; P+ v* d1 J% g- N
, P1 q: l4 h9 d& _4 W <style>
8 E7 W! k0 k I5 v# G& e .modal {
: X9 D& m& g" d- {+ b display: none;+ E2 u8 P" c1 R) R( G
width: 100%;# e' R2 N; D, j+ v/ }1 c @
height: 100%;, G! j$ y8 l9 r# _+ a: D, ^4 h
position: fixed;
1 K: b7 F5 y; l overflow: auto;) r k- s4 t) \
z-index: 1;: m4 N6 Q+ r t8 O4 q
left: 0;. _- q$ V! l7 ]1 j# ` j
top: 0;6 H( S1 D0 O p4 s) `
background-color: rgb(0, 0, 0);
( `. H/ T) M" a7 ]8 \' J /* Fallback color */; v4 [* m# J# h* O6 j8 T+ B) X; u
background-color: rgba(0, 0, 0, 0.4);% O1 Q/ `9 j$ a# E; r
/* Black w/ opacity */. D9 p! j+ A( a" n- U5 Q
padding-top: 60px;; A* r% t/ }* Y# W+ ~
5 B- D+ ~1 U% r! p' w }6 W( z) L& o# X- Q
/ N6 P& a6 v1 w, g0 b) B) ~8 d .modal-content {, `+ K/ H0 X, Y/ U" W; A
width: 60%;
% c. x. [5 g9 B! j background-color: #fefefe;$ U6 A3 ]# ?2 B6 g, H
margin: 5% auto 15% auto;
* `& l, F2 j+ H! i- D4 u border: 1px solid #888;7 P9 }% G" d" o- A# e2 j
B; K) ]; R9 f6 d0 {
}7 V4 E2 I* F$ L6 C
$ F9 G5 h- ^/ H* |4 S /* The Close Button (x) */
6 M' P' I& B% g .closeButton {: f- Q9 C- _. ^4 ?8 S. z
position: absolute;
2 P% u$ T4 | B2 {8 Y6 L/ \ s right: 25px;
3 z4 h0 N( K* [6 G top: 0;
' a. V; F8 \8 k# |8 {2 |' G: S: c color: #000;, D; A0 `3 c4 q, B8 J+ n
font-size: 35px;
! @3 G, Q* @* r7 ^ font-weight: bold;% m/ p! |# r2 B$ b6 Q* _+ f
}
$ z0 X1 q6 d/ Y8 P0 Z$ i* W# r
! D1 N7 x# }: q5 c! n# b .cancelbutton {
4 i& r0 c8 V. ~2 ^ width: auto;. Q. G0 Z6 M9 j
padding: 10px 18px;3 a) C7 j9 y ] x% Q
background-color: #f44336;* n/ e6 w3 `9 n' @
}
' F/ t2 g' z$ V
( T' A9 G1 k! }. o3 ] span.password {' R- P9 Z* S# @4 g* h
float: right;
) ^( c* F2 k6 a6 M padding-top: 16px;
2 y4 L9 c. M8 v6 G% J0 k$ B }
3 x2 | t3 W# r( N
) W" Z4 p8 P2 R4 o3 P# x .closeButton:hover,- m7 C) U D8 \6 G! {, y# P
.closeButton:focus {5 h% x+ t& V' p1 D1 t
color: firebrick;
6 I& i& ~4 ~0 q" E cursor: pointer;
: R* y" B3 G+ u, o; y( \+ \/ l- x" C c
}3 w) I" y: x$ d
0 M( ]8 E& j& u .imgcontainer {
, q( q9 |" {( ~( B/ _ text-align: center;9 \7 U/ L1 i q0 Q
margin: 24px 0 12px 0;" A* [6 ~' v5 M, G. ~: n: E- ^
position: relative;' o4 f& i5 j. }% k3 c( @" }
}
0 q+ w, s8 k. [2 G, d ]4 s, R M
3 g$ a+ k! P& Y4 G; u$ y9 T .avtar {
* @1 S6 ?" l C9 Z& |% F# z5 l+ D width: 40%;. Q. |" o7 H; d& [% k, W. w
border-radius: 50%;
+ a' Z& q. U! u& q. Z5 b }/ U, U3 B% x( J( |, T, J! C
3 }7 [' A8 n+ |7 `' n% x .container {" ^# J" `% h. v( j% l1 Y! B
padding: 16px;
; B: r2 U1 @5 z2 N- ] D' x }
$ u7 n* C5 r8 p. |. l3 ~% b3 V! b/ D4 x/ L7 ?0 r; Q& }6 x
/* Full-width input fields */
% n9 ^( z& o4 N* x4 V/ L1 {8 y0 S input[type=text],
, D7 x' F9 o1 K. d6 I7 } input[type=password] {
$ S. F# k& Q, E$ ?9 X width: 100%;) |0 {# z7 E; Q9 f; P
padding: 12px 20px;
$ l3 k5 ]% U( t margin: 8px 0;8 @% D# R3 i6 P# `
display: inline-block;
8 N; D$ C1 s7 a( j# V0 X border: 1px solid #ccc;0 U+ ^4 W4 }1 V" i' f) R
box-sizing: border-box;
# S+ T7 s; r: f2 N4 t# G }; _5 s$ x8 {& z1 L' F3 y
- U$ \' Q* G! f) k
/* Set a style for all buttons */' Q2 g3 G; U, k( A
button {
2 I4 Q; |" n$ u9 C3 T background-color: #4CAF50;
2 U. r- T) B3 j( G; S# n( E color: white;7 G; |' n8 b# P3 P
padding: 14px 20px;
/ i7 J; e/ ~+ p' g2 w$ ~8 k. y margin: 8px 0;
, Z5 I2 z/ C# ~8 S' T) h border: none;
& x5 K* [9 ^8 ]5 S5 e# R5 l cursor: pointer;/ F' I" ?, O5 t; e7 f4 i& f
width: 100%;" G- e9 a# Y/ }& ?' G7 v
}
- p7 |+ C0 i% b) M |& ~
5 x4 W* e& ]& G d+ c7 e: c5 f
- V7 f0 c9 C4 r) I7 y3 ] button:hover {
4 M! d1 P, G& P% @1 K opacity: 0.8;& s, Q E8 E* n9 R. B' g
} s6 A; ? a! Q$ }
' e9 H# H& e$ E6 p
/* Add Zoom Animation */
7 T# v) _/ G* }' e4 X0 h& J .animate {. @0 m8 _* D/ v
-webkit-animation: animatezoom 0.6s;
2 H, K; }: a0 B animation: animatezoom 0.6s
* I$ f! f9 K% B' N+ T" Y }
8 J0 z( h Y* B" d# S1 P7 _" N: t0 m* z, k9 P% O) I7 L4 D0 M/ z
@-webkit-keyframes animatezoom {4 o5 {& x1 |7 M; J
from {
9 d K |% T: f1 k ~+ h. G -webkit-transform: scale(0); s' E9 s* _8 ?
}, e! r7 m+ E" p% Z+ b
0 G$ B* k; |) \6 a, [& D
to {8 d( A8 |5 Z! w
-webkit-transform: scale(1)
* y/ p r2 f( Y, j }
- J7 e! ?: E1 `6 W' F7 ` }' t; X( R9 i4 q; [) ?7 g. x
# y" D1 w ?; d2 p* z$ `0 Q @keyframes animatezoom {
( r# N; _4 L* N; u. g) \; } from {
) n' H7 Y9 D5 q! D& |% ~; g transform: scale(0)) H9 B5 X) C" Q: Y2 W6 P0 y
}
9 Q; T3 ]& `6 R# R5 F6 {
" ^. y9 S, a( R# P9 G" k; j to {
7 [# P; ?% |: z! Y transform: scale(1)
' q+ K' f# z+ V# j4 L/ _: y }
3 y$ n3 I- B& d+ C/ i% B( W }
5 R/ D! _6 Y7 O0 ]" j' d& d. F /* Change styles for span and cancel button on extra small screens */8 T- |% V( R: ^5 K; W6 T
@media screen and (max-width: 300px) {1 I% S, j% ]. I# k' s
span.password {
5 s$ Q' E: C" ]! x display: block;- G) q' y, |, U9 Z) ?
float: none;
t2 W) ^& N3 d; V }
2 I* N0 L4 \- Z$ o6 R1 @& R' a. }7 o8 W0 P- _. e6 ]; P- ]5 W
.cancelbutton {
; R+ |8 l2 b, u# \ width: 100%;
, a/ i" V, W# D8 H) p l. } }
" E$ v; o8 o. e( B) b A }# c7 W% C- {4 Q" A5 f
</style>" Z$ J" t j' j! E5 s$ Z0 Y! @
</head>3 B% z4 q. O6 i6 S) _- K- }
) M* _/ Q' s9 ~- X* [
<body>
* \1 L1 G) ?8 b8 }, r
?5 X& h+ G5 B/ C' X4 v <button id="login">login</button>4 F" ~9 M2 x s3 M) s
<button id="register">register</button>
: R& P; w* ]5 Y& J
6 R1 H# t2 Y0 W <div id="formPanel" class="modal">7 \3 ?4 e4 r2 v
<form action="./img/logo.png" class="modal-content animate">, ^3 Z4 e3 ]2 V% V, t, Z7 F9 w
<!-- image -->2 s" F# N/ T/ D2 C
<div class="imgcontainer">
# W/ {* k; u$ t4 M <span id="closeButton" class="closeButton"
, ^: l. m! T) W1 t9 l
5 F6 T) O( G8 F$ `6 D4 O9 O title="close form">×</span>
" S1 o$ Z, k4 O' S3 p <img src="./img/img_avatar.png" alt="avatar" class="avtar">
, Z/ w0 v1 D! U {2 u* G# j </div>1 f* K7 |# t% Q
<!-- information -->
1 [' F% J2 a: g5 `) x <div class="container">
8 d! j' U3 F: [' X' ? <label><b>UserName</b></label>* A9 P3 n: }0 ]7 O
<input type="text" placeholder="username" class="username" required>2 Z0 ]. {/ s% N- p- ^
<label><b>Password</b></label>
9 a) X$ C% f2 z5 h/ o( ~ <input type="password" placeholder="password" class="password" required>
9 A- }1 h. A% h! W, ]. Y <button class="loginButton">Login</button>( H: W% g; v5 k5 Y: @/ C: T* [6 @
<input type="checkbox" checked>Remember Me
6 i# I3 X) Y0 `$ {) [ </div>( S$ p4 q7 u7 }: m
0 ]6 Z7 P7 x9 E& c <div class="container">/ t2 j+ M7 D9 |
<button class="cancelbutton" type="button"
X& j( Z; {) F% X& z >Cancel</button>
) S, ^6 ~& T- e- L7 ]% ^ <span class="password">Forgot
# ~( ?2 g! g% | z+ H( o/ q3 g <a href="#">password?</a>
5 \* x; [* D/ Y$ j' Q D& }7 L </span>
9 H$ E8 k$ t0 `# ` </div>3 s" w7 ~' H0 r- S; ~
</form>
- v% Q: O9 S5 r" ` </div>
/ L* w% i- W& u' u4 _( U# U- o& p) n3 a: i- R+ }/ Y. @6 r- D
$ b" ?; ?! |) p. c <script>3 H9 Z& ]2 L- U& N% z
; |% [' m7 f% t5 U
function loginForm() {% f/ l! Y; ^6 X3 f
var formx = document.getElementById("formPanel")6 J" N; c+ M: V' |7 N I
formx.style.display = "block"" Y! Y- o" c, G2 ~( K
}* `3 A; e9 ^! B
</script>/ T' ~1 j$ R4 p1 ^, _8 ~
& }" |9 G; L8 N9 y
! D0 n o) g- J4 ]1 ~</body>
/ w- K2 T/ N/ N* x: N9 n2 F+ [2 o/ \( j! L3 L
</html>[/mw_shl_code]
4 R& _0 u# T0 g
: u2 U2 ~( |( i2 b! ^) f/ n) c1 p* A! ^7 H2 Y+ q2 Y
注册代码9 W# ^: S* W$ `% l) ~
* ]" d% G+ j' H! [" l0 k) ^
[mw_shl_code=html,true]<html lang="en">
3 ~8 d1 G" ]& g$ H# |) ^! e$ U7 @2 [$ K* d
<head>
6 v' k1 o. t1 H1 B# C2 b3 t6 | <meta charset="UTF-8">
; `- K- i# W g p <meta name="viewport" content="width=device-width, initial-scale=1.0">
* {$ q: P# `6 }5 P* t <meta http-equiv="X-UA-Compatible" content="ie=edge">
7 N" g) x6 s8 }" t <title>register form</title>
) `( ]* {3 N4 K* X( X8 ^/ B
/ w# n3 B+ }# i <style>
* z: m' h9 M- @5 K6 t0 ?9 P- P .panel {. N! s" t$ d6 ]8 w h; F
width: 100%;5 t0 y" u2 {; t
height: 100%;5 a/ |+ X% D, ^( u R4 S1 m% d8 M
background-color: rgb(0, 0, 0, 0.2);
/ \/ m2 i4 j5 ~3 d padding-top: 30px;$ u$ S: C k5 d/ [: Y) {
overflow: auto;
6 ^# y% H7 d% M `: { position: fixed;+ M+ `9 D% {; q! {
left: 0;
; M- t0 w, V) E X right: 0;
0 d1 h/ W- v( I- P% h z-index: 1;
' B4 n* h; q- G* e }+ x5 ^8 H& n, \; Z
, S" z! }2 } B) A1 t2 Y .modal-content {
; [ D3 _; Q$ L background: #fefefe;8 R7 V4 w# p @' ]/ v$ l
width: 60%;
5 b" w$ f$ q7 M border: 1px solid #888;
. }" Y- U0 C; K; g( }) v- R8 Y7 I margin: 5% auto 25% auto;
S( ^5 B$ O8 C+ X& B' I4 y" o2 J$ P" Y& J; J
}
4 Q* W5 e9 g" }2 v; d; C/ b% l! d: p( L& L8 d' L* J+ G- r, ^% `
.container {
: c( [8 ?- f: r# b9 \! A1 E padding: 16px;
6 R3 a! n3 Z; L& f$ ~3 U/ O }
# e& S/ }, |- _* D6 N( P* O
* B4 D- K+ |$ D8 @, q) a1 E% |& N, ` .close {; I1 Q: G8 ], ^( a0 f, v
font-size: 40px;$ M& T! `. m( P5 k- K ]' ]
position: absolute;; T1 V1 W& Q& |) x5 |
top: 15px;
4 M5 Q7 g. v/ j right: 20px;4 i; D% c2 q8 Z
}
9 T) B0 Q, ~7 {7 \0 E l
, v) |4 y: J1 ]4 g0 C .close:hover,
! |/ N: I1 E2 {$ I; a7 ^+ b .close:focus {# e' T% a7 O1 S
color: red;
" [) l* h0 @3 R) a7 ]4 T cursor: pointer;
' a6 T5 ^. m. q- a% b `- J! c0 d }
& A' v/ b2 N9 `1 H) k2 ~
" D4 {' L, v- Z input[type=text],
% S. v8 @# V4 R; E input[type=password] {4 W3 I8 n, n( w4 ?
width: 100%;; R" o: D* d) V/ B
padding: 12px 20px;
+ C7 T* M$ \3 { margin: 8px auto;
9 Q) V: |; f, R9 _9 V border: 1px solid #cccccc;
1 ?5 _" D6 C5 g H0 B% L- A display: inline-block;- ~4 z. q- j% }1 r- @+ Y
}9 Z* r# r2 e' ]4 d) O0 U+ w
" [. t$ R/ n* {! X7 _ button {7 A* _# X2 D. z- a" b6 I7 @) e
background-color: #4CAF50;- V2 h7 ?( ~5 K! r. L
color: white;
" F+ k- d0 i- S! [. s- K$ p' @1 m padding: 14px 20px;1 {" ]0 @4 a9 w4 s
margin: 8px 0;7 _; ^3 M- J9 l' H! `) j$ H6 x
border: none;8 j5 A! A, q' K) ]
cursor: pointer;
- y9 [/ g" K8 c5 F width: 100%;
" G7 j; O$ J. C7 q' `- J# f }9 l1 \& {) A* c, z8 Q* m
' X# p+ l) ?- O) J/ Y! h! g3 u8 X, L
.cancelbutton {# ~8 s; y. Q7 q$ [
padding: 14px 20px;; J/ B7 L2 v. |$ q1 Y7 X
background-color: #f44336;
8 u; s0 Y( d+ q* s/ N" _ }2 S. _9 {1 ]+ q- {* W0 f
: v( W4 Z* }2 R! u7 h2 n @( B
.cancelbutton,8 E) F" ?3 e/ l. u5 f' i
.registerbutton {$ n; F2 Z6 H: q$ P, u1 q3 I
float: left;
: i. N- R- D; a2 R width: 50%
" T; ]; |6 n0 q! R }
# O8 Q2 X4 T# m" o0 O4 b- e" q! |9 d+ U0 L0 ^
.clearfix::after {8 ], x' O1 [+ w- {
content: "";
6 K" L+ H# K4 d' x8 ]8 O, L clear: both;6 u$ ~: T) K% R6 i+ {
display: table;
6 A0 g' @& j% G6 w }5 q1 I$ y- @' h% O. F
</style>' Z) Y7 y7 a0 s# h0 Z
; L% Q" i7 v- Z9 e$ q" J9 X" F
% \5 \( b" P6 q- V. ?
$ Y- Z( v) t; m* r</head>& j9 x: U% q# G
: s/ f, S; Z2 ~: l<body>
2 `3 B9 f# a; y L0 x
9 s$ g6 S3 @9 L9 a/ E* b* m <div id="modal" class="panel">
0 b1 V6 U) l! w1 { <span class="close">x</span>
7 L6 O! K& i8 X8 E <form action="#" class="modal-content">8 \; a; b6 G* ~# T% S T
<div class="container">2 w1 X% }. s6 e* X" Q
<label>Email</label>
3 v9 g+ W6 f- L Y1 W <input type="text" placeholder="Emmail" required>
+ |; ~# y1 u8 U1 H1 a+ u <label>Username</label>5 \# S6 m/ m" p3 e8 G
<input type="text" placeholder="username" required>( i# L+ b( @. E c- I4 d
<label>password</label>3 L, n r3 [ X6 G
<input type="password" placeholder="password" required>
6 {8 Y( h5 u; ~* Y <input type="checkbox" checked> remember me
1 L. U5 B4 E2 X* ~# N/ V: i# T8 V <p>Follow the policy <a href="#">terms & privacy</a></p>
4 K* b7 f8 G( w1 B( A( k9 |; |* V8 \% I& V
) g. l4 h# J& w6 {8 V" Z
<div class="clearfix">
# t# R% v& }% j6 T4 W <button class="cancelbutton">Cancel</button>
9 W8 w5 K) s% z1 G; z, g' H <button class="registerbutton">Register</button>. A0 s- |! Z; I& ]' S+ n
</div>, x3 A4 W' V, R
</div>
: [- o2 a! q' _ </form>
9 V4 n7 I+ q! l </div>
$ l1 Y6 o8 K7 k. L6 B. ~
8 f4 n; S. b% p" ~9 x) i3 I( ~' w3 k% J0 y) m7 G" r; L
5 b" k$ k7 j3 D# Q2 g
8 g* ]- ]6 T: p$ ?% ^6 Z: c
9 }) @& g8 Z2 N: a5 ]( n</body>- z# N) t! p% P" l) c; k' ]) w. u
|; S1 M9 ^" L* l3 ~</html>[/mw_shl_code]
; g8 p9 p" k0 [* x8 C* O8 ^- s |
|