|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
* l. i- k" w' p/ F; Z; \5 b! a8 B/ T* Y1 p" `. Y4 S3 N0 }! i8 D0 Y
* M0 L+ m1 t9 l0 I/ n
登录代码:- w; j; y) `+ a, ~) }# H
6 A' I) I2 c' ~8 w1 y
[mw_shl_code=html,true]<html lang="en">4 v$ l I( ~3 i) @$ {
3 k& a, O3 \: x8 S; i2 F& E
<head>
3 u' o# J8 x- H$ A1 N/ G) l! A0 U <meta charset="UTF-8">
2 n; y! z7 `& z; o. s+ M# q <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ H! n9 d) {; R <meta http-equiv="X-UA-Compatible" content="ie=edge">
1 u0 E6 l: [/ h$ | <title>This is a login form</title>: w) L; R; t+ ]- c8 X% ^
x1 b9 Y7 z F* z9 \) c5 k2 ?
<style>2 j3 C/ s" {1 L4 H5 P
.modal {: p/ Z) V: I+ I! ]0 ^3 r) B' i
display: none;4 J2 \8 ~$ d4 R1 [
width: 100%;5 [, K& \# J2 O0 S
height: 100%;
0 Q3 ~+ v4 Y' X5 K5 ~8 B& n position: fixed;& d- f- `% O, _4 K. r, [
overflow: auto;
' |1 V9 m1 X' ]. x3 ^. r" O* Y7 M- [ z-index: 1;
' I* b- P9 {6 [* s* c left: 0;
5 [% G9 M% u4 U: E9 y/ I _. l top: 0;4 U: _% i. ]* I, O* A
background-color: rgb(0, 0, 0);
% L5 }# y6 y) k% [9 P2 y5 ?- A /* Fallback color */0 ]# r8 N9 n/ p. T& H4 S
background-color: rgba(0, 0, 0, 0.4);, I4 ]% ~- c9 p0 k- A! J6 @
/* Black w/ opacity */7 u+ O; V |+ b( k. H" n2 d) Z5 d5 p6 t
padding-top: 60px;
. K t q/ x1 D7 d% X1 o$ Z' W+ @
}
/ @- b" m( e% w0 |1 X9 `, t4 R4 G+ p, h* _3 I1 b* Z: H( ^
.modal-content {: C; [! Q: w+ K. K' n: ?4 j9 n0 x- G
width: 60%;3 }% _+ S# P) K( C+ X* N
background-color: #fefefe;/ b7 I! T2 F% G/ m& Y
margin: 5% auto 15% auto;
- |# d: H6 L8 U5 R3 R b: J p6 C4 @ border: 1px solid #888;
" n! k1 e1 T1 q8 s! U8 V
" q% e# H5 x8 R9 V2 L0 B: Q }, E9 \% i# M$ `+ p' U
4 o& m0 y( y; x( e5 f5 c
/* The Close Button (x) */
: M* R$ ?. ~0 ~ .closeButton {
, {/ ? m& t1 R) m3 Z position: absolute;8 H' Q1 y# Q* S4 I6 S3 n
right: 25px;" u1 m6 x! a _% @- e
top: 0;
2 v% b! q8 Q4 f$ X! q4 c" ]9 r" p color: #000;8 T" G8 }; _9 F1 P* r
font-size: 35px;( q# L8 H+ o6 d
font-weight: bold;
- _- A' {" ?, p5 K/ ~ }+ o, r: {. U* y
4 _. `' x9 G2 J4 g9 g7 m- G
.cancelbutton {8 D0 O: i+ r: K, O, a
width: auto;
' ?4 O& K3 ~' A2 O- H padding: 10px 18px;9 U7 |% m: @% @, D5 z! G" \3 K
background-color: #f44336;1 b( m+ M( v1 I0 _, L% F
}
! I n" I0 i$ P& E
+ x+ K* l2 h( H span.password {+ _9 a( r U/ Y; P" s8 T: O
float: right;
( [5 G8 s4 G$ r5 G padding-top: 16px;" [+ w5 C) y2 d; ~# M- D* ^
}) k& ?% s% P! [6 A
/ S: D) f1 N1 {! v
.closeButton:hover, Y0 Q! W: @. c3 q; A& W9 ]
.closeButton:focus {, t- T6 c% I5 j+ j
color: firebrick;
4 p1 Z0 D6 B" _' c C cursor: pointer;
# e, Z, y% m" n. T |* c) o1 b7 r M# K4 s
}; g( S! X' u9 S/ x
/ y) h0 d. Q" A
.imgcontainer {5 w' b1 B- u6 m6 u5 f
text-align: center;4 ?, S5 u4 Z: P- ~7 @
margin: 24px 0 12px 0;
8 A ^% d9 Q, Z2 a0 r* N6 b position: relative;
0 d# l, V$ b5 ]( u/ Z7 @ }8 ?+ X& c; l9 x/ n0 _
! z' ^# E' W2 l0 `. d8 t: r
.avtar {
`3 ]) p2 k7 ]5 k width: 40%;
, ?1 z# N$ I( X8 |6 l border-radius: 50%;
# K) p3 V1 \ U8 b$ \$ x& g }
' J% m: Z @. F2 g& ]' N0 [* \6 [8 g
.container {
2 s% X" b. c8 ]' g- j G; I padding: 16px;- _- u0 y' Z" h
}3 G9 L! O" ~( W0 j
1 d3 z W+ f9 y9 X% F
/* Full-width input fields */
$ J+ t( x+ p6 W3 m( J! C6 w; R input[type=text],
+ Y9 N2 J- S$ |, V5 u3 j0 X, [ input[type=password] {
$ q* k7 i; A q/ ? width: 100%;
% C. i+ I9 g5 R& P* T padding: 12px 20px;$ A( h( }! w c
margin: 8px 0;
+ p, J* ? m' O4 A display: inline-block;* \9 H3 h& N+ l. D- `% ]$ [
border: 1px solid #ccc;
$ e( z7 \* I# }: t7 e } box-sizing: border-box;( n$ G1 d: I/ g, f+ ~/ G0 y
}
) T! U" @. `. C, X0 F9 `8 ^- r
* M4 }2 A- n0 b /* Set a style for all buttons */
# A ?( g! u! Q1 m) _ button {! |+ D9 |- V; }' N
background-color: #4CAF50;- L3 {( D9 R/ V7 n( X
color: white;
9 j9 \: A$ G2 \% X4 A) n3 g padding: 14px 20px;
/ ?* c0 z' _! e+ R margin: 8px 0;; i! ^- x, f8 F* Q2 I' h( S0 p0 F( ^
border: none;* P) Z0 H' K. W0 ]9 L- L
cursor: pointer;
: D1 E7 Y" U: F width: 100%;
! l1 E& e2 l- I, _. x, ~" x/ u# D6 j# w8 l }2 F ]0 b3 f8 a& q- v" D) L
' d5 H1 S7 @3 ?( i: g' {* `3 U" H5 b( H* c2 B( I
button:hover {6 o2 d' k2 j6 ~! w0 X4 M& g
opacity: 0.8;
S# \/ h( Z) [* m% h( ^ }9 O* Y* f6 a( N/ {7 F9 T2 v
) j$ y' y* M+ _" D0 [) W4 j /* Add Zoom Animation */5 ^* H/ k, C+ X+ v+ l3 j9 s* a& x
.animate {$ N- V: L' e) g1 x+ X; L
-webkit-animation: animatezoom 0.6s;
7 H8 X6 j+ a p5 o animation: animatezoom 0.6s1 u$ g! j8 g) X& Z+ N- b5 q
}
) ~* ]! [; D8 w$ Z9 G: K% \% C3 |% Y) y& E
@-webkit-keyframes animatezoom {/ |/ m6 }6 @( \/ }* ?/ M- K
from {0 S9 o; ~7 b: z( \9 V1 v2 k) X1 {; E
-webkit-transform: scale(0)& `- y2 X: l) U6 E, y* V e& a
}( e0 d) M6 @2 v/ R4 W) b. D
! K) P3 A+ q1 H2 b, s; C to {
9 q4 K6 q" O: [5 W9 [; g# b -webkit-transform: scale(1)
' c+ {# _! }( Z0 U/ v' U, _/ s0 O }
& c- u9 Q# K5 e* H3 {6 C }
" {9 t! C2 P: }$ Y7 D. O
: n1 A2 M( V4 t# u @keyframes animatezoom {
# [5 |; _2 E( P) d" z. G9 Q from {, l3 g8 ]- u) C) Y" K
transform: scale(0), l0 r; e& M5 H$ m% g$ g! P
}
& a/ V9 g" B4 {0 g7 Q; P7 Q) q) {! X/ u2 R' @
to {1 x& v8 ^+ h. r
transform: scale(1)% f q- V' g& Q6 i
}
8 W, r$ {: Y9 T2 O" a) L }
; q0 g$ `1 j l /* Change styles for span and cancel button on extra small screens */8 m8 X& T r1 c- q. Z$ Y
@media screen and (max-width: 300px) {
+ F+ `$ k7 C* `& e9 n f: J. A span.password {; [4 J, ^0 t" `# W$ d
display: block;- }5 y- f* }* j9 |$ w6 [0 m' A R
float: none;4 Q0 Q1 l1 M0 ]
}% y( P' R- g0 P) G% a
2 M1 _/ i5 s$ Y( t4 O .cancelbutton {; D* Z% @: Q. {# I
width: 100%;
' d. d3 G. N2 S% r4 s }
4 Q8 i, o4 P1 Y1 _ }: i2 [) x$ U0 ]4 O
</style>
) Y& x9 Y/ `; S2 M# M</head>) b% ?, p8 f9 V" ?
3 B9 s* i3 } T( q<body>
' j# K) o' G3 R9 k% B( _
4 u* [$ N% ]7 @ <button id="login">login</button>, A- y6 Q3 G5 @) ~( T
<button id="register">register</button>0 G: e4 V0 ^. Y' v" s: ^7 m+ Q* J
- s1 A4 Y+ g# @. P9 w' N* o+ e
<div id="formPanel" class="modal">
' E2 D; v9 [' X! e1 y4 K <form action="./img/logo.png" class="modal-content animate">% R( t; n6 M8 Q8 g
<!-- image -->, }1 n! H7 o* E' ?* Y
<div class="imgcontainer">$ P# l$ u' K9 R" c- u
<span id="closeButton" class="closeButton"
5 k, z6 C v, r" e! V4 K4 g
; Q3 E8 |) x. Q+ |+ `0 I/ r title="close form">×</span>
0 w$ e5 l+ `8 T* t' t <img src="./img/img_avatar.png" alt="avatar" class="avtar">0 p5 l( ^9 l$ x% j* N; l$ o- R1 U
</div>( V8 E' Z( |( i5 f$ L. K( N5 v
<!-- information -->. n" ~/ y% d# d9 e- f& n4 l! K
<div class="container">! {5 O) ?7 `0 a7 h3 R& `
<label><b>UserName</b></label>2 G* p) [8 n7 V! a7 t2 L6 `
<input type="text" placeholder="username" class="username" required>8 Z3 w8 y% y9 R
<label><b>Password</b></label>
) A( O5 a- A/ u# ~3 k* k# Z1 Z <input type="password" placeholder="password" class="password" required>) N* B0 n: u. ?2 A% T
<button class="loginButton">Login</button>
2 q% E8 b- I! l6 m) w <input type="checkbox" checked>Remember Me
' D+ p, |$ I9 R! M, Q& K </div>
6 D( W1 N( e' _. y! G+ d' g& I3 N0 F1 J/ P3 o2 O! R' X
<div class="container">
; G- K! g' R* h) u( }7 F <button class="cancelbutton" type="button"
! Q X/ x7 h b: G( w >Cancel</button>
- S3 g( `. _/ C7 p <span class="password">Forgot6 d2 L6 ~8 A8 X. \+ E
<a href="#">password?</a>0 u; I4 f% Q7 B2 l
</span>2 l+ Z" t: E, B% M
</div>4 c& O6 `' e$ w/ h4 I; o$ g! s
</form>$ L/ p! l2 j3 G
</div>
" W4 U _- w0 R7 U i( E" k
3 R7 ] k( x |$ U
% u! f0 S( \, M' [$ T <script>
( j! p) Y2 A0 w
7 Q0 e9 I" C6 @) m- K* \ function loginForm() {( B& K% I( V( M2 G1 k- q
var formx = document.getElementById("formPanel")- g" D \8 C5 a$ b' y8 Z
formx.style.display = "block"
: |7 L* T4 ]3 A }3 o4 R% Z; Q: D1 ^* n. m; ]8 E1 L
</script>' g6 W& s, P7 t
8 _9 F# @: ]6 u
8 o; j' y) d* J$ M1 T7 d
</body>4 t7 B/ @& ?6 ?) Z/ ]5 |0 D
* M5 ^2 y; n! g9 a" a0 S5 S' E9 h
</html>[/mw_shl_code]
- S- t/ R/ `7 n0 G8 H4 Y
& v0 ^& C% T7 w! ~- ]& z
% K# @3 V+ _" r6 ~1 M5 B注册代码
7 k4 j( u( o% M/ q, X( h" ?6 C4 w: |6 h, g; ]
[mw_shl_code=html,true]<html lang="en">& ]4 r& e* D4 L W& p& F
$ G- y, P. F( d8 |- g
<head>5 h; w9 D9 L- S' K2 [8 c3 ~/ I% e
<meta charset="UTF-8">
, U! K% X& x) f4 {& i <meta name="viewport" content="width=device-width, initial-scale=1.0">
1 s K+ {- C% |. K; J <meta http-equiv="X-UA-Compatible" content="ie=edge">
4 m- `4 i. D' ]$ W <title>register form</title>
. T5 c% @5 L) p- O, l9 h) f
: j& `# ~% e0 Q. n/ K <style>/ Y$ v4 ]3 }) S" X
.panel {/ j# j9 o/ i" d- `
width: 100%;( ^4 [. ?5 s6 ?2 c
height: 100%;
* |0 ^0 N) n0 h9 v" `! Q background-color: rgb(0, 0, 0, 0.2);
4 N# f# x+ Q+ ^. c padding-top: 30px;
k% G, F% K2 k: l overflow: auto;! |. D7 s( [4 v9 W, E8 }
position: fixed;( _6 j8 e% U. o0 K$ E
left: 0;) P. B0 P t; X! s
right: 0;
5 n6 L* B9 ^4 T, v z-index: 1;
8 ?. e$ V" ]* Q/ O" P }* ~9 Y$ ?0 K0 g9 B9 V
: U: y' D$ d- P8 m$ ?, ^; V& I! r( P$ [
.modal-content {
{: u) f6 e1 o0 B background: #fefefe;
- z9 y9 x6 M8 l! H8 H) J width: 60%;
7 M X* n1 X2 D border: 1px solid #888;
) `. w9 n! @( e$ n0 C margin: 5% auto 25% auto;
+ S6 K! P& G" R% V- |. {* C7 o/ a. ?
/ q# \* ~1 m* l) R. O }- \5 Y4 _% a @ F5 C8 K& Z
9 C/ w& \( T1 c) a: i
.container {; o8 d# l0 A# ^5 q' F
padding: 16px;1 }2 V( L9 Y L3 w8 J
}9 v- E( {3 T$ q& ~& i8 \
5 u% h- x2 s% ]' B3 d/ @5 J2 p .close {" f- a* R* T* d1 I8 j' t1 @8 W# Z
font-size: 40px;+ ^4 ?( P7 Y5 ^3 j5 t2 A$ W
position: absolute;, p* n4 O! S: p" u& ^8 h1 B5 ^
top: 15px;
: o& O5 l! ^% R right: 20px;, O$ {5 ^! B2 X( {1 J' b; C5 |2 |
}
" t% F" u" E" T1 p8 j" E3 z A* |; h
.close:hover,, M1 J" q8 L- g! z7 X
.close:focus {6 h' h7 Y5 Y# t
color: red;% t: R' F+ V+ [/ F; v- D
cursor: pointer;3 i! J5 N8 z" l# u6 `
}
) M+ l, N3 [7 y) L: f
" ~' z) S% F' ?# j* k* U input[type=text],3 |; _8 s( Y, l! v2 N7 J4 O' @" A4 N
input[type=password] {
+ ^8 k# M+ l y6 W* N: f1 [ width: 100%;# K8 a7 c+ x2 \6 K. {! p# e: S
padding: 12px 20px;! a) d4 N- I1 z3 I
margin: 8px auto;
: G! G9 H+ U8 E/ v& O" a- W border: 1px solid #cccccc;8 T$ L, z$ K8 z' D) I V' h
display: inline-block;6 X$ v( P: F3 U4 \, ^8 F
}
' S' @- v1 X$ u) u( f
/ g( F% W( ~, Y }8 C button {
( H& d$ R; ?% z, v) D8 L9 u5 j/ U8 z# m background-color: #4CAF50;
8 H9 W8 ~) l0 v( i3 t color: white;
0 ^! @* g$ T5 K( f R; \ padding: 14px 20px;9 `( d% w" t7 |. n+ Q" {" _
margin: 8px 0;+ n& {) u" i6 Z# R8 e7 w
border: none;7 k2 e, I; ?( n: T0 U0 ^
cursor: pointer;1 q3 D7 |) n( ]# [" e- o
width: 100%;
0 L# c! l* p; e/ U5 W }1 |4 S& f. a" I; e9 L, W4 ^' ^
$ g1 y" p. O9 L5 e. T1 F .cancelbutton { J$ K+ V' j+ N, N4 K- \
padding: 14px 20px;) f1 n4 j* R4 f% H1 Z$ _
background-color: #f44336;
+ P$ H. V+ d* i2 {$ \: K: Q- @ }
, o6 {4 R, K F" T( Q" X8 C) Y* D6 O v. b' ^9 d8 U+ ^- Z
.cancelbutton,1 N' ^# X5 Q! t, e+ d
.registerbutton {0 O4 A# Y. X+ v0 q. ~: n
float: left;( n4 [4 s" b: Y; t8 X# u/ j! A' I
width: 50%
, k5 U. [: }8 h }
! ^5 U* u- l! \& h G7 ?' B2 o+ V+ w) }
.clearfix::after {0 Z3 h) ^! K* ]$ Y
content: ""; b- H$ o7 _1 ^) w! [
clear: both;$ E/ ]- }2 z% H
display: table;
V& u$ X1 ?+ n. M }
1 h+ X7 _, \7 N5 f: V4 u </style>: c3 ^" U2 T) ^# q
7 ~, E8 a4 _6 x2 Y) P! z9 q* n4 K @7 |2 p
: T7 Z3 U% _% x5 l' G</head>
! p. `5 b' Z; i. O" X7 C8 S5 F# W0 J
<body>5 ~8 t! t# R. b/ M7 b0 c: p
i- x1 Q3 H3 T5 D. R: W <div id="modal" class="panel">
0 n* {- }- Q6 E% F2 A9 C3 f# n" _ <span class="close">x</span>+ e% ?/ |- e* f9 T
<form action="#" class="modal-content">" E6 f0 F) u% d$ d! f
<div class="container">1 ] k, w" r; [3 \0 h* }
<label>Email</label>
1 ^" z) F; s( ]* U# t) c <input type="text" placeholder="Emmail" required>* r5 @6 o; o% n, N) @8 h
<label>Username</label>
- i9 `7 `. s: f6 ~4 \% `/ P <input type="text" placeholder="username" required>
( S% w" b3 j- ^7 W# H; S <label>password</label>4 H0 i" D% ^; k! Z/ p P
<input type="password" placeholder="password" required>
4 j- U K4 N( V' \+ O% U <input type="checkbox" checked> remember me
7 U+ @& [$ N% C# ? R5 g8 I <p>Follow the policy <a href="#">terms & privacy</a></p>
C; a7 {; F) U2 J& u+ G5 Z
6 I! L* @3 h* d3 k/ R! H Z/ F2 _/ L$ ?7 e/ V5 l1 m
<div class="clearfix">+ ~4 f9 z! f. f" i$ R
<button class="cancelbutton">Cancel</button>
6 T( T! l% p) V m2 ]/ |$ a4 i <button class="registerbutton">Register</button>
1 q7 m( i( w% T' K5 q+ h </div>
+ m- O9 l( t; l8 ^9 F6 V </div>
: b) c& v, T' W. j# k </form>- A/ M, I. j; l4 U1 T8 O& r& T$ e
</div>
& x7 E- b9 T. e2 D7 r9 X
# G6 I5 Q r5 r5 H+ H
8 S! Q {/ A: q* n3 q( r$ H) [
6 a& S, y1 f7 {$ `8 s& G' [
# W8 K [; w h* w$ y; j4 [. g- d! h! g$ e
</body>+ o& C% G2 A0 T s- W4 q. l+ U& y- P
) B6 C* {/ V8 r) ?. o. Y3 m( s# K. V
</html>[/mw_shl_code]' }: ^( I9 O5 T: v6 u
|
|