|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面1 C' ^( u* W) j5 [% z6 J
# b) i8 l4 \ ^+ L% f# j7 m
4 a& b" X$ p8 O% O
登录代码:
! d9 n1 ~4 E/ y% g. B- ?# x7 W! ^. S8 C0 |6 e$ m2 I c6 v
[mw_shl_code=html,true]<html lang="en">
5 }. j5 h" x) C$ a) m9 u) r0 ?3 M8 p
<head>
6 [; ~- o# S- }2 S, w0 @; n w) o# z <meta charset="UTF-8">6 n4 n' W7 B% S7 h1 G& i; {
<meta name="viewport" content="width=device-width, initial-scale=1.0">* t0 _ J8 X9 k# U) e" H
<meta http-equiv="X-UA-Compatible" content="ie=edge">
6 Z+ R. l, v7 P: z <title>This is a login form</title>2 Y6 U) P) T, M2 \7 W' n
$ o) m$ R- Y% h$ F. L' F8 l <style>
* s- ~9 U8 K! _; @+ w2 f .modal {
, e/ y. g+ D5 ~2 @1 Q0 V% S4 { display: none;! T) ^4 G( [9 \: H. a$ t/ `* `
width: 100%;
0 a- l# S" f' k% A* O height: 100%;
* f" Q9 m9 @2 n _5 J& P: E# R% a position: fixed;* B5 K8 o/ _+ \8 V5 \4 }
overflow: auto;1 X l9 W1 R* ^% \1 j* ]- }4 ]" n
z-index: 1;
4 r3 e8 ~- Y$ D/ k( P left: 0;
) ^" i+ i0 J1 _ top: 0;
/ J8 b) v9 v' K3 c d; O) C3 {* X background-color: rgb(0, 0, 0);
( ~- k2 w; p9 Q /* Fallback color */
# a5 n4 m- w7 p* z) \$ { background-color: rgba(0, 0, 0, 0.4);
2 O1 j( Y o% D* c0 K! Q" w /* Black w/ opacity */4 H" t. y' B& R, N. ^; x
padding-top: 60px;
. a! K- [6 f) n/ p8 N( X+ s) C* X# v* |" \. W
}
Q# N5 m1 K1 c x7 K* f% e/ I8 v* m% A k! i+ f
.modal-content {
L; W1 p! m# {) a" V width: 60%;# a- c, V# J6 \8 x! |, c+ J
background-color: #fefefe;7 U* r) Y% M( n; ^7 S
margin: 5% auto 15% auto;+ ?* q% S5 @" ~0 A9 u9 b g
border: 1px solid #888;
" Z2 V( P) K! C+ Y. r: p2 U; j
% R; U2 i: K" r3 M: l2 ?: L$ b* r/ P }
D* t7 ~9 W H' ~4 }/ _& R% E ^0 ]3 f3 b" n. E0 }$ N
/* The Close Button (x) */" {# \. Y) n D+ n" u5 z4 j0 a
.closeButton {" W, W' n+ p$ v) E. U
position: absolute;2 H! Z5 I* t4 K8 r
right: 25px;5 k2 |& T& E0 e4 l# f+ _$ U
top: 0;1 ^1 d# E( T$ \9 Z- G
color: #000;/ m) b& n' }2 Q8 J5 i" A
font-size: 35px;/ n" I& l4 _9 x8 H1 b0 r* E
font-weight: bold;
3 F7 B! B/ ^1 G, { }
3 S, s3 w! t% l: i: W1 C0 n# {$ R: G8 `' o" a& ^: v8 x
.cancelbutton {
1 W6 U" p& K: p" ~5 H( U8 ?4 ` width: auto;" D- v$ p# D; I
padding: 10px 18px;
) I2 I2 t3 j" t) D0 P! `9 W background-color: #f44336;! V! I4 s, }: r; r" A; ?2 Y* {
}9 d$ R5 d, X1 G0 j8 ^
1 R" r+ H5 I& w* G" a. Z span.password {
+ ~+ r$ X- B: S$ t$ E float: right;
/ _( K; M4 ~7 E* R- { padding-top: 16px; e' ~ h; m/ N4 K; m3 ]
}3 i' D( C; E6 M6 p2 m9 x; W
& {/ J/ \$ O$ f) E; ^2 I: F .closeButton:hover,+ G0 _+ `+ |8 b0 |6 u! G
.closeButton:focus {
4 `7 I* `; U7 c' U color: firebrick;0 [$ `" c j/ X! q& Z
cursor: pointer;' c' L: ?' V' W" \3 x/ L) U
! y1 ~- X9 r. m! i
}
5 |' B0 f& y4 y2 f
+ g# T+ e5 o: q) \7 Z a f .imgcontainer {
% q% |' i6 V, ~( u( Z text-align: center;) S' f7 D p3 ?
margin: 24px 0 12px 0;: ^9 k- y g3 G3 X
position: relative;
# _5 ? m2 a4 z$ }7 u4 _$ W }
8 k$ ~) p* u4 H5 s4 x2 P W5 T+ i3 p1 |0 c+ K% ?
.avtar {% Q# g8 I) s5 z2 M5 N+ Z
width: 40%;
, w- f8 |( d( M; [4 G7 M border-radius: 50%;
1 x7 M) W. X0 q* }, o4 O6 z N }& t) i) n7 S& l8 L. K
2 T+ w; V* {( J1 E2 c .container {( C' W: Z% r) V5 i; J
padding: 16px;4 M5 ~7 n7 p4 ] L
}
; m( ~1 K _. \/ V1 K: E2 Y) R" }; @
/* Full-width input fields */6 l' d) {3 E( m( p) {1 y
input[type=text],
2 j4 Y! p! i4 i6 O/ A! C" e input[type=password] {
. e; ?0 L) c( y; t: y& a8 u width: 100%;3 C7 l+ c4 F# i# g
padding: 12px 20px;
! {. d( K) |0 X6 Q6 K7 c! E3 ~ margin: 8px 0;
0 ~; `$ I0 m1 W( c9 `5 H2 I( C display: inline-block;
5 Z! ~- g: a+ a. @; e! o border: 1px solid #ccc;9 O1 a+ M& H H( l
box-sizing: border-box;
% m" ?3 S2 O- ~# G" @5 ~. V- c }1 e A5 k) m2 O7 r5 u( `
( I6 p( L8 I3 a K6 l( W: d+ i /* Set a style for all buttons */# E% L% x, R& Z8 K! o: u0 i
button {9 t% q5 p d" V, n A$ S# y
background-color: #4CAF50;" @5 @+ _ j; o5 u% r& D
color: white;# E* S% Z' ]2 ~8 U! h
padding: 14px 20px;
; q: x* v# G8 X& A4 i& v margin: 8px 0;
9 h) ?! ~- o- D' h border: none;
" G& L3 D; X5 l8 U cursor: pointer;
1 g J) E7 f1 a" n9 J8 h; ]# P' l width: 100%;
4 @. g6 O) F) O1 A: S) |9 S }
- n9 ^9 {. s6 P: x: K" d8 _/ u$ U4 s0 V
% u4 Z* o3 m/ Y0 L5 F9 C6 D! ? button:hover {5 T& G- h5 e3 n' }; ?+ I: ?2 K
opacity: 0.8;
+ b$ j/ f- X. ]; Z }
& Q/ @( J# ^; J) _; N/ x
# I0 z2 r3 @" @! U @. O /* Add Zoom Animation */
& [0 M& U+ P' G0 f .animate {
. K+ G1 I& d L2 b2 b% R -webkit-animation: animatezoom 0.6s;' E/ u/ y9 [; |# l3 D2 D' [$ d
animation: animatezoom 0.6s, x7 r. d6 {$ g, S0 |# e% G6 d: o
}5 Y+ n" \% m% O, x5 b9 ]
9 o9 i8 p- K; z
@-webkit-keyframes animatezoom {
+ B. ~( {+ N: d9 E' ^' H3 z( R; y2 E$ f from {8 K/ r6 o3 O L- J
-webkit-transform: scale(0)
4 T$ n- d$ l' q9 t, h) } }
9 D3 ?9 E2 v' _: d8 C7 M7 Z2 d, \& R; k) A( I- j* A: \/ [
to {
2 f* h$ r" x: q. |) O7 V$ G0 h -webkit-transform: scale(1)
( x7 f4 C9 X5 I, u }7 j4 w; M! K) v( Y! F
}% m b4 y5 G, h: \6 A% {
. f8 Y& z& r1 }! U/ P! Q. `
@keyframes animatezoom {
/ n, D( B) U3 |* L8 |0 k6 A4 I2 j from {2 B( ]) P" p6 K, G: v8 f
transform: scale(0)
) O! H4 k3 `: n) @- s }
7 ?. W4 S5 V$ h+ h7 ?" \
) o* P0 W3 y3 h0 y- F v. k+ k' ` to {0 L6 u8 g) n6 u; a
transform: scale(1)
, A1 l. X5 @% R+ G' c3 Z% i& H }# m/ m; x$ ^' N3 i, Q/ _
}
$ A. W* `) J9 e3 w- H& g /* Change styles for span and cancel button on extra small screens */1 H& x% L5 Z2 ]7 b8 o5 I& E6 }
@media screen and (max-width: 300px) {8 g2 D3 D: y/ J% A
span.password { ]; G' r) ?% a) R$ Q) E
display: block;, B- N% f4 f4 T9 Y6 G2 U9 y
float: none;# X/ t* L+ w* i4 i% R4 d
}
1 J- |) h8 s; \/ A; t6 C. ?" i) g. \9 j# {9 }9 v, _4 v; q
.cancelbutton {
0 x/ P$ U; a7 y$ T4 A$ Y width: 100%;
! q& U$ R- E. A r3 \7 } }
8 _9 e/ s8 a; G3 t* S, D, r: ^ }
# `* N T- j: S! @6 e </style>3 A/ E8 ~0 M# u8 x6 W( q0 b' P; |; X
</head> J$ i$ ?7 `/ E/ V3 R) F! |( G3 c
; h0 Y9 |) s! s2 _7 I<body>
/ s" A- W* U" d6 `- ?8 J$ F) W$ q2 a2 G
<button id="login">login</button>! O& f5 _9 m& k# z
<button id="register">register</button>: a0 A3 s% U/ l" z! R
1 K6 v9 Y8 Y4 [( I0 r
<div id="formPanel" class="modal">
% W) j- ?' R' i) I, R <form action="./img/logo.png" class="modal-content animate">2 i% ], \) Y+ Z6 p5 p1 O
<!-- image -->
$ ]0 R: @, m1 H( C" ]3 s' E <div class="imgcontainer">& v9 ~! Q S4 e( [
<span id="closeButton" class="closeButton"" o) s! C* k8 d# B4 x/ S) z* b
9 n9 w# s; J e# ^* t7 l
title="close form">×</span>
# n/ n3 c5 w6 Z <img src="./img/img_avatar.png" alt="avatar" class="avtar">1 [+ X2 B$ y. `0 l% X% i
</div>
l- Z/ t* ]+ g+ l# P9 t) V0 ` <!-- information -->4 I% O, R* k+ h: w
<div class="container">" z d4 x/ v! D2 K% {
<label><b>UserName</b></label>
! K1 a+ j& r: d- _" ` <input type="text" placeholder="username" class="username" required>
! L" X; J, E# R" V <label><b>Password</b></label>6 L( |; w L! _, w- ?
<input type="password" placeholder="password" class="password" required>
' _ \% v) f. h2 @ <button class="loginButton">Login</button>
$ s2 v, x( n3 E p3 V <input type="checkbox" checked>Remember Me
4 o) } d* R4 B </div>6 a3 E2 }+ T5 l5 I
7 S7 R7 N' A" N+ A) A9 `/ U' L
<div class="container">5 R# P$ k1 N4 r$ Y5 a" M
<button class="cancelbutton" type="button"
# k1 R/ c- T* D* Q; ]' K1 k >Cancel</button>
' [: }( @ c; J7 } <span class="password">Forgot% f" G8 {0 B0 ~0 k F2 N& Q
<a href="#">password?</a>
) B( R$ X/ @0 |' B4 X5 p </span>
1 F+ Y+ S$ C% T& o) p' W2 z) ? </div>
. a3 E. ?0 ?2 a, g1 v </form>: P! B3 J+ @0 i
</div>1 H1 h V" T' |" j3 V7 v) p7 g
9 V8 d9 V4 k9 {$ D" k, p# H; G1 I8 ^; A
<script>3 I" Z- S- R9 A
% P. A+ D) c9 X! g0 y3 l& N5 y5 n
function loginForm() {4 k& H6 n- K7 a
var formx = document.getElementById("formPanel")
& ^% f8 a2 H6 c! s/ { Y formx.style.display = "block") ?% D7 Q' R9 p; i' I7 N6 v
}% V+ y W4 _: w* {' i% w! U
</script>
. H2 o: O2 a* x6 ?
; O& s7 V, y6 ]: W2 J# O! h- s& b5 p& Y$ p
</body>7 t: q1 a2 z. ]8 P
' _7 N2 Y9 D2 F- w$ Z7 G" N- v</html>[/mw_shl_code]
1 ^5 y* N9 D2 i$ \ Y) E2 X9 H5 l9 I1 ?& _% m! ]+ s2 ^
2 Y8 g& l- Q$ j注册代码
( g/ ?3 t; F2 C6 C. _- V. Q. b. D9 ]9 O
[mw_shl_code=html,true]<html lang="en">/ B7 m$ s! G0 h- h" Q) G- b* K1 ^
/ Y$ Y% V7 ?2 r
<head>- k7 B1 M5 M* i d+ M, V$ i+ c
<meta charset="UTF-8">7 q; I8 O0 f' Z
<meta name="viewport" content="width=device-width, initial-scale=1.0">
% g" B( h9 b6 s0 e& O0 G <meta http-equiv="X-UA-Compatible" content="ie=edge">
; j; n( r* I9 I- F U <title>register form</title>
; b% v6 i& V u, L! d: Q" b$ T
6 G# q" S( @( e( r* q6 B( l <style>
) }' ^& t7 c+ g8 @2 M* L( f* {/ H .panel {
, A& H0 \ X: _8 A9 g2 \ width: 100%;" k* H$ \7 ]3 o1 r- R
height: 100%;4 M7 ~& w7 n( k
background-color: rgb(0, 0, 0, 0.2);" N6 f" Q6 {$ ^1 s$ U
padding-top: 30px;% { N2 r, Q' W) U- b7 G; I! x4 O$ Y
overflow: auto;
, X; n8 E& @, }" V& Z+ r2 t position: fixed;
( d+ Q: |, O" T left: 0;
9 S0 l" x6 v: z8 h$ O right: 0;% Y1 L7 O9 j8 T ?
z-index: 1;/ u& z& _% F: c/ f. Y
}
( p2 T4 V# x9 C8 y4 b1 J6 E1 P' z0 @8 I, D
.modal-content {8 H1 k9 L+ m- \/ D6 ~* x( B) b
background: #fefefe;
1 u1 \" C- u, X* u! R# g0 ?$ M( B width: 60%;1 a. o7 n- T: x
border: 1px solid #888;
; s$ S! {2 ^2 o0 X margin: 5% auto 25% auto;
2 \! m2 C! w" J- O
* j# T0 F! K8 V4 b7 c3 p }
7 ]+ H: O _+ D; b6 V6 n- w
# h1 w2 f) [0 |6 y% {- w .container {
+ S) U) W* r8 ^4 f) ~ padding: 16px;( y1 D% `9 K; a
}
2 G( D' ~1 M4 |1 [5 o" K' e: i9 F- k9 ?3 l/ W6 m7 J
.close {) u' c1 F- ]4 _/ X
font-size: 40px;
: L5 J j- m* _ J' t position: absolute;
$ E: a3 p4 M5 T1 f* R& i( F+ | top: 15px;* f7 J$ |) v) \' E% j! O4 }
right: 20px;
1 s/ P# h ^. F1 _" A$ L* U, B }
5 ]2 R3 m G3 T# l, v7 L9 g0 Y$ G% f6 Y+ d& Q
.close:hover,
1 c" w; F2 D: I: k/ B .close:focus {0 J `5 s; h5 {) f7 ?
color: red;+ w& g" ^$ o* v
cursor: pointer;
7 |2 P. Q& p- K: i+ U5 |3 E }
% g; j; d8 W$ c; \6 C# J) [$ s: u7 z! Z4 h: c' D
input[type=text],
0 E4 Z& S* t8 f: z* _' \ input[type=password] {$ t: U4 P) j/ U8 p7 b% ], L# ?+ E
width: 100%;3 ^7 S) I& I: I; ?4 n! d7 P
padding: 12px 20px;8 u/ v9 V5 g2 l( f& _
margin: 8px auto;6 t) f1 r& X/ A/ |5 N2 x8 X9 y4 M& G
border: 1px solid #cccccc;/ ]3 a2 z! G5 t0 h, @: A% I
display: inline-block;
) N" h- P5 v3 p: x }
8 X( K: _0 a3 M O: e3 M$ ?5 ^
button {
& v$ s6 A$ A/ u4 y# a- o* h$ A background-color: #4CAF50;
" C- C: w7 N# {3 k color: white;
! B# W: J- Z/ D2 D( ~6 P padding: 14px 20px;# D* v0 s3 }! x4 q
margin: 8px 0;0 g" {* h4 o3 `
border: none;
5 G8 {4 `% H9 I' G: M$ D$ E: c cursor: pointer;" M8 `' r% K6 b9 _6 u9 v
width: 100%;
# Z/ i7 Z% P+ f }
l, f; ~# g# v
" f1 s: ~9 z( Y .cancelbutton {: Z+ o S. }7 V6 F" D
padding: 14px 20px;
3 |$ n2 V* ^, \+ j) ]( K& {% `" } background-color: #f44336;6 v6 O6 F" p5 {
}
$ w$ W4 B( k4 m8 \" [7 N4 o$ ]' ~5 u( l2 {2 N
.cancelbutton,
: E# m9 [* S4 j4 ?. `( z .registerbutton {
! S) |. \/ R6 ^6 z float: left;" u d( E3 L4 H/ k: L
width: 50%
7 C9 Z0 O3 T' i* f }9 m3 v9 b% \5 {# g4 X
. Y( i" E/ p8 s. ~% E$ S8 j* I
.clearfix::after { H* ]( o! X' O
content: "";% ]3 k4 b/ G, G R+ Z( r! E% l! X
clear: both;5 G: x5 A( A5 a/ z# y' g
display: table;
; o4 X5 E8 R8 m }
! w, L% |. g0 @. m% X; Q2 x% a </style>$ d f& P) J* _: Y& d
. J+ m7 j0 p& h$ c! u0 |% b1 j1 b; h% \8 b2 [. v) O* s7 b
$ i7 K5 S8 \' W0 a2 M</head>9 O$ O7 D* k! L# F
3 b, u- }' }$ x5 i, a
<body>
! j/ l/ V X( e x, @. r' g
3 t) i* | W4 j- ] <div id="modal" class="panel">4 W; y G/ u2 P9 v/ A; V; [; G
<span class="close">x</span>) N2 Q. e( f2 J7 Z
<form action="#" class="modal-content">; i2 T; ~$ I" g) Y/ Q
<div class="container">
9 P* y1 j7 i& E3 f7 v' G <label>Email</label>: n1 \* k' K# y$ G( I( R
<input type="text" placeholder="Emmail" required>( c9 `1 a' `: E, t
<label>Username</label># @, A/ G- z) U5 d7 m
<input type="text" placeholder="username" required>: ]% h% R' o% [ i$ o
<label>password</label>
9 w0 h: i+ L2 a, V <input type="password" placeholder="password" required>0 \" F! y& M5 ?. j3 u* ?. q
<input type="checkbox" checked> remember me
, m5 W/ R: O. l' ^9 ?+ c% R, s <p>Follow the policy <a href="#">terms & privacy</a></p>
* k" H- h0 s6 R" y H k% D3 }2 i6 `0 }( a
+ T1 ?; H! W% H+ C( |
<div class="clearfix">6 f1 U0 `, F0 J7 ?" K+ f% m1 q5 r
<button class="cancelbutton">Cancel</button> Z+ \! m# E' ]
<button class="registerbutton">Register</button>
: D5 }$ t6 e9 Q8 U </div>* Y0 D$ i/ U: E; ?# d
</div>
8 _) J. S! V, J. w) K! y, @ </form>7 X- N# X. P- |( Q4 C. m) n
</div>
2 y4 Q% l& R; x. F" S+ H/ W, V: V }3 p* q/ m6 B! y) N2 ~
4 ?0 n" h# N$ P. S; |9 X
: Q( z5 D6 Y/ N- |7 s# p' f2 e# ?; z6 y# ^' I) _
; B2 `# ^6 N [6 F
</body>& g2 U( T- q4 S; Z2 F
/ K$ Z- o. Q! [! ]7 f$ G h. Z+ U
</html>[/mw_shl_code]& [# _* n# L V% A& h/ {
|
|