|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面) e% U( V1 {4 }# Y9 r
# h, b+ A+ V1 b& _' E9 X1 @# J
4 i: Y7 _7 Z3 O* h4 X
登录代码:
. O& x% M7 H4 T) x/ S3 \: _9 f8 ^6 W. @: x6 a+ g
[mw_shl_code=html,true]<html lang="en">7 S; C! V k+ b( Z4 E
2 j) R/ r9 H6 j) _9 J, F<head>
1 i1 @" Q" f6 E7 ?+ L1 z! ? <meta charset="UTF-8">
2 u! I1 t: i2 U; [ <meta name="viewport" content="width=device-width, initial-scale=1.0">/ ^0 Z( }7 u x& Z& Z- {
<meta http-equiv="X-UA-Compatible" content="ie=edge"> ~1 y4 I6 T' o% c
<title>This is a login form</title>* Z% a) e6 K# `% N# ?
- S% s# Q' e+ ^: _; F
<style>, J& r) S! U! G1 X9 \
.modal {
6 u, z: B6 O: s# `) u7 {# y4 P display: none;$ F" X6 C n& h0 g$ T5 B
width: 100%;
3 G! u0 @: a: W0 K4 x2 Y) O$ L3 g height: 100%;
/ p% G4 F" |9 F8 _5 p) h! c6 C, Z8 p position: fixed;" c" |: g0 q9 G) f+ _" i
overflow: auto;
* x6 z6 Q/ j1 a: j3 o# k* y2 v z-index: 1;
) f( Q* a T. N left: 0;
# I: ^6 t) V$ l top: 0;
$ k0 U3 b0 i7 I z; q background-color: rgb(0, 0, 0);
! ^$ x# D/ p7 `1 K _ /* Fallback color */
: @2 W+ f6 {4 F) b background-color: rgba(0, 0, 0, 0.4);6 ]2 ^0 Y6 @( U& f
/* Black w/ opacity */
4 A f& U% w" j# } padding-top: 60px;
" M: @. {- r* Z
& r: `3 A/ p; n$ f. t }
/ S4 s0 b1 ]' y" v( ]# X/ d8 ?: o1 ?2 ^7 f3 j) [
.modal-content {
' ?0 u- o) h/ m, b width: 60%;
; e) S0 X* {( N U9 k background-color: #fefefe;
" g. w3 B- k& j! X$ [. |) A7 _ margin: 5% auto 15% auto;# g& Z! }& O7 {# G& }
border: 1px solid #888;8 Z9 m: b' x0 {& M
& N) h- s8 }" Y. O
}$ {, ~ S& P" ?. r! C6 S/ B* |# g
, P8 c5 O; m" T" i8 X9 H+ Y+ h /* The Close Button (x) */
" J3 ~: ~) D3 g .closeButton {
' m: U4 |! G' g L1 ^ position: absolute;, Z: ~' f+ @; E) d# w
right: 25px;
0 {; ?2 P% ~4 M; l5 H3 ^3 d top: 0;0 _( O3 E( b( j' [& K6 R
color: #000;
3 l K, ]' _/ J" |( A- }4 _5 ~ font-size: 35px;
( E* ]8 `2 a/ b font-weight: bold;( |! o; ?: O4 b6 j/ K& F% @9 q
}
( d% s f8 K" `$ ]$ F6 F% D) z7 G( w6 u+ G1 X2 X; ]& Q
.cancelbutton {) X# s& P3 ]4 f; [* J% z- @" w
width: auto;
, g5 D9 x. Y& I. b) P padding: 10px 18px;
/ h$ O/ K; b6 S! J% W background-color: #f44336;
* M* h6 K* X" H% N }
3 M: S# h1 L$ \ L {8 A# Y. S& s9 Z6 D; O4 j7 N
span.password {
0 k5 l- k- k1 S# F: _8 D float: right; y/ G( L( H# R% y
padding-top: 16px;
2 s1 {% w; S7 R7 H7 z; d }/ {: K: Y3 P- N( C; z- ^/ q
$ }+ q" ~: Z9 M$ W9 E2 j" D0 g% V
.closeButton:hover,
K" R; t) R* M .closeButton:focus {
X. a; K* ^' Z color: firebrick;" o* W1 \- x, }7 j1 ?
cursor: pointer; y6 o/ O2 d7 ^4 A/ J% r M
- S0 i; Z1 o2 e9 P }# [; Z- i: B a9 _- L
! S% P7 |7 [% p
.imgcontainer {9 S& g2 C+ u0 H: [. w/ l
text-align: center;
) ?. s( \/ f5 p9 l margin: 24px 0 12px 0;- h8 A. h+ R2 ^
position: relative;
$ f$ x8 [, V' Y. O }4 Z! S1 I/ [% n- v4 D) S" ~, Y
# l( Y# m) _8 T {: B( I8 e* D
.avtar {0 X; d3 \/ Z2 w. w* A$ p, U% K
width: 40%;3 X; ?, V# F& F( w$ s
border-radius: 50%;0 F, e! `5 o' m) e! B
}: K# N1 h0 W- l/ D
0 \" c! V+ {* {3 `4 P9 A- J, j3 F .container {
_" O# \6 p5 X4 O0 a padding: 16px;9 ]+ P) s$ v/ V
}
: ^4 B o ?7 R8 ]! v; v! M8 _
% L) J6 P. E( O# \7 V8 j, W% N$ w /* Full-width input fields */) L8 S( C5 B, ] d2 }3 f8 n0 i
input[type=text],
0 G% m0 p4 \! n* H# @ input[type=password] {
+ Z* X% X" z3 J- P+ ~. i8 | width: 100%;
: L. x" ]% G, t7 ]3 m' f; J padding: 12px 20px;
+ B4 z& X* F7 H margin: 8px 0;
! w6 J/ F% z P9 Z C9 @2 m* _ display: inline-block;
# ~5 i P3 x( j, c+ C border: 1px solid #ccc;
& L; H* y; V- v% g, W; k box-sizing: border-box;
, f) U! A+ T8 k6 R }8 Z& D. G5 Y; W8 r" l* A6 g# c
( d( N. V/ ^& |& t
/* Set a style for all buttons */8 T% i) @+ C# L3 ~( x& m0 A8 u
button {
0 {$ s3 j9 S9 ^$ b+ f& L2 @ background-color: #4CAF50;9 H5 f! k6 v- b# i' I
color: white;
9 f" t& C7 H4 ^2 C3 L2 t' o4 T padding: 14px 20px;- L' A+ c6 X ~4 _/ N
margin: 8px 0;
0 J& N3 z9 O: V5 h' M( t border: none;5 \0 t# K5 [( ~5 ^2 g0 z* N. z
cursor: pointer;
1 _/ }5 L& X$ F& P0 Z& ^/ m width: 100%;7 P+ J$ }2 r0 w! S- Y* X
}
! X! D7 |# @" d+ F c2 C; {' C( X; {8 W2 m
) d3 O; s5 M+ a- M' T button:hover {
2 z) a1 ^( m7 s9 z opacity: 0.8;6 [. N S- G6 N9 J
}
* Q2 ^( F0 q# E2 J; S* v: j% m! w0 A& b0 Z" H: u
/* Add Zoom Animation */
9 l& E K& x6 u J8 T% H1 c2 t .animate {" c1 A- m8 c1 y, X
-webkit-animation: animatezoom 0.6s;' q: Q+ N3 A, r3 {) R+ A5 ~
animation: animatezoom 0.6s* B0 q6 o! y+ ~# O* p1 X7 F
}
- P5 B# v2 U: z% k1 ^5 M, @, A: c q1 \: t' |# Q
@-webkit-keyframes animatezoom {
( b! Y) L& f+ o, M9 l from {, J) L) f+ ^: M+ u
-webkit-transform: scale(0)
) S1 S$ G+ c3 }4 ~; F$ S }
& D# i9 I3 k5 ^ ?, Q
# T. y7 e8 K1 d/ I% g2 i to {
4 M8 c1 m; A* A! C* V -webkit-transform: scale(1)2 Z% g$ x' c: C, \* g2 o
}
7 s. [0 h, G3 l5 ]. ^ }6 d: _2 g- e4 f2 Q' Y! @8 A
( _2 O3 y2 M. t
@keyframes animatezoom {+ \& Q8 q' d. @% z
from {4 q1 ]0 x4 b8 \
transform: scale(0)5 y/ J$ M1 K/ E
}, b4 j' O4 N1 j3 v7 U# {
0 t! K% Q$ @0 V e8 |: r
to {1 H* Q3 N# r( V: ?+ H
transform: scale(1)5 X L" Y/ L" N2 u
}, T. R1 Y9 H# I! X
}
2 P' l6 w# r M) u /* Change styles for span and cancel button on extra small screens */
- B) k- L, L3 Y4 g* q @media screen and (max-width: 300px) {7 J6 B+ ]6 @) r8 W9 T: x
span.password {8 _. I; x3 G" ~
display: block;
; ~- P; g* u9 ]* q float: none;
$ g2 T3 \) q9 ?. f; M5 @' E& o- w; Y }5 T2 a0 \5 F/ i9 O
* G7 D% u) K V; w .cancelbutton {
1 R" I' ]* B/ ]* l( a width: 100%;3 M* h! a8 c/ e
}' _4 z" ]; L% l
}8 x; |* d O4 Y3 _' ?/ C
</style>
! m' }/ y3 q0 y5 Z9 @5 ~: t9 A5 M</head>4 p( C+ F$ h0 w
" X' c0 i R3 \1 w4 A. \
<body>
0 J: B& ~) p* C, `1 ^; F0 V, O9 R) w$ m- f
<button id="login">login</button>9 U- t7 A) d) I, H3 d
<button id="register">register</button>
: {# D6 n: g! |# U
: W1 C7 [% i6 y; ^4 { <div id="formPanel" class="modal">) W5 Q6 Q- D: f' F
<form action="./img/logo.png" class="modal-content animate">- a$ x0 u3 Q C9 a" `
<!-- image -->0 `& j: S7 x F y
<div class="imgcontainer">
' h7 ]2 V W* N/ u4 U <span id="closeButton" class="closeButton"3 C, }$ }: k1 B+ M7 A/ d' Z" c
# Q0 `9 z2 t5 A2 c0 E title="close form">×</span>+ \# T% U8 t% K
<img src="./img/img_avatar.png" alt="avatar" class="avtar">8 y: V |" K4 M# n8 ~
</div>
; E- U1 A( O# ]) F1 ^ <!-- information -->1 r1 N( ]9 N5 u9 E/ Y
<div class="container">
# F' Q7 P; I8 s! x: F+ A <label><b>UserName</b></label>% l. ?6 h: e# H% E
<input type="text" placeholder="username" class="username" required>5 ?' V3 W! B6 w4 t; S5 b9 M
<label><b>Password</b></label>
4 C$ A L, U$ e; O3 _5 s <input type="password" placeholder="password" class="password" required>3 v3 X: ]) |$ p! u! c: i; W- r
<button class="loginButton">Login</button>
! g1 R, T4 N0 N' X8 z7 J! Q; O <input type="checkbox" checked>Remember Me
! b/ c( c. X& }; y- ~; J </div>) O( L4 j7 ?7 C1 `( k. E+ @0 f2 B
$ Z* T' x2 x M, i' ] <div class="container">! I8 W. T, u( p+ g; `8 q
<button class="cancelbutton" type="button"8 u( {/ K9 n0 H% U7 |
>Cancel</button>5 t5 B2 X1 E6 [4 \1 s
<span class="password">Forgot+ u- W2 I3 e+ H# |! ~1 x$ s' c( i
<a href="#">password?</a>
2 f. |- k2 m) m </span>6 Q/ z# B) @. s% e4 f, E
</div># ~% L% Z4 z* e2 \' W$ }* G
</form>
$ Z5 `& V4 y- m0 G3 I; j1 N </div>) e6 ^, b3 u. i$ H8 F
, C8 d! t* S' c! `
; m' w+ n7 f y" @2 b0 [, f8 i5 `4 @ <script>
2 ^1 ?2 \' X. _5 Y9 V
6 v! @0 ]% L' N/ D8 i7 g6 ~2 r function loginForm() {' r1 {# i! V; H u( R* J4 z
var formx = document.getElementById("formPanel")
# Z5 O% b' m3 [$ s" l$ z9 b6 N: D formx.style.display = "block"
; Y! e7 p6 S7 P8 w* P& ]' Z }
( h+ \0 @# Z. D0 h </script>. j P9 E: ?0 m4 b8 Q1 q9 X
z: j. n4 X! `
' a4 D0 O# }; C+ \1 m/ E</body> l9 H! G$ ~$ [9 l; H5 w; a9 t5 Z0 s
* }9 m2 z" ?+ ~- o- ^1 ~/ V; T
</html>[/mw_shl_code]
9 d1 s# i e1 m0 c( q
" g: i& k+ J" t# b5 c
) t% \5 }2 P# `% e7 J; }0 {注册代码1 T: k3 ?5 h8 w
6 J/ ^- a) T: T8 v _, D[mw_shl_code=html,true]<html lang="en">
" m9 I- `$ M) C& K% X3 g4 s& Z
3 _4 O' ^; T0 \7 }$ |' o<head>3 \2 ?; o5 O/ v' p. _
<meta charset="UTF-8">
N/ @2 r1 j8 X; i' @4 ~ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 R" m& Z* y. o( v2 d" w <meta http-equiv="X-UA-Compatible" content="ie=edge">
" h- O$ {1 B; n& a7 {& P' e- d u <title>register form</title>, V- X2 x! T4 B! f9 l' C7 Q
5 r& F% O* _, F <style>
. s( v6 E8 `9 d .panel {/ N* ~5 r3 \* C( h/ G
width: 100%;' d! d6 u: K1 U
height: 100%;
! C4 w2 z: u, w6 Y$ R. ^. S background-color: rgb(0, 0, 0, 0.2);( [% j' B: c2 O$ ^0 G" R
padding-top: 30px;
2 G, S# J' l C4 E overflow: auto;
- a" U+ q. q6 j! b& J position: fixed;+ D7 T8 Q& f3 |5 r. w2 V. b
left: 0;- C) w8 z5 \ h& l# _
right: 0;8 y" H X* `' r6 k. ]% g
z-index: 1;& h* q) d% E; |+ f- v) A
}
9 \3 c3 l& h. M% N8 ~2 q8 A2 C
- D% ^) t) I/ M3 i$ S/ P { .modal-content {+ D" W9 M, q2 W1 m) d. P+ @
background: #fefefe;
; e- E5 c+ f+ Q width: 60%;/ H* t6 [8 N$ b8 l% y9 g0 Y V
border: 1px solid #888;
9 C: Q/ d z: g& e# N margin: 5% auto 25% auto;
8 `# R- U) L+ k' s- T' V7 c
" r$ ?: }& J) L1 t m( w }
& x0 a2 \* U; K5 I. x* V' I
6 ]! z" l) L( u$ s .container {
+ Y8 T1 g& x/ ?. ]3 h; B padding: 16px;) {5 Y2 q6 @! `5 A. q
}4 M, H5 u; G- d* Y2 W3 M6 T
! P7 M" M! g4 f( L- |' u
.close {: l6 k5 u5 t a
font-size: 40px;
- }; z$ C. a: }! L) ^) X position: absolute;
; }9 y7 a5 }+ x- k0 G! k: a4 w: y top: 15px;' D, B0 Z- |- c" p t
right: 20px;
# \* n8 n+ Q, h. U: ? }8 d; y, N; l! [% B: V8 B
2 v% q; m, ]3 t2 u: ? .close:hover,; X3 g/ e$ O8 u5 Z6 F# M
.close:focus {
! Y4 A1 p+ d7 y; `' l; W color: red;# z8 B& Y: @; F7 j
cursor: pointer;0 K t- @ d$ O8 y
}4 B& e- E! N3 l3 b
: c/ W; W6 u. d$ \( V" m ]. l7 K input[type=text],
! e/ R/ y2 M7 o3 P8 v9 F7 }# L; T input[type=password] {
2 b: s4 x! U7 g! k1 b width: 100%;% H O. O( Y2 t; r, L2 ]) G
padding: 12px 20px; ?. C7 v8 e. o. ^3 Q: u
margin: 8px auto;9 K, D% T% v( I- ^' j" I
border: 1px solid #cccccc;
1 D# g( O3 s1 K; M+ c3 w% {5 l display: inline-block;
, O, g$ t' i$ @( k }
; M7 ^ r1 N1 _, _" s: a" W. i' s
button {
9 R- }+ }6 X" I* v/ b6 O$ r- }4 w* y background-color: #4CAF50;# j- u; @6 l4 a
color: white;: ^9 C8 a" _. }! U. T8 O
padding: 14px 20px;
) y. g8 g/ l. ]% Z2 n margin: 8px 0;; i! d6 S) x& d. G
border: none;5 H, V' q5 t9 X& V* g/ @
cursor: pointer;* y6 a0 K3 c5 c/ k9 J
width: 100%;$ C5 r/ Q9 K! s/ e; w. d
}
' `! w# i( D4 c, D
6 G) E- A) b% R; K .cancelbutton {
' y" {( Y: G' [ padding: 14px 20px;( M U j$ a4 _' W. Y" W4 K7 d' [: Z
background-color: #f44336;6 S! |5 I7 E- a# s2 V3 I
}
: C3 a8 K& T, M$ B* m3 o' ]; f: F7 i" R! O- f: m
.cancelbutton,
5 h3 N8 r( W' n .registerbutton {$ E+ a& f+ G, E, q9 B
float: left;
1 M* y! [4 C% N6 z width: 50%+ o/ i1 ^, g6 o) O' O" [
}
9 B, x# p( u+ t+ j1 d, p8 y% w) r, ~( \
.clearfix::after {" G5 _% b7 w4 ~1 E g
content: "";
7 G$ e( t `3 d3 H8 ] clear: both;3 \1 ^+ i; ~/ ~. u- l
display: table;+ F8 ?5 [2 |/ X
}
5 z9 E0 N6 s, I7 I7 y </style>' ?* z! L9 `" p9 {8 y' P" c5 ?1 N
/ r) [9 R' |8 U8 t) R" m$ x
4 o6 `# k+ A1 ]3 B4 }5 r6 I, e2 W/ [ J- h3 C, B8 X U. E
</head>
4 E7 c) h1 q5 D p3 p: Z" W3 J" k( Q3 }( L/ W! Z7 I; [, Y
<body>2 C. J6 I, P% P
! p% D% S- O ]. _2 k" ~% U
<div id="modal" class="panel">
) }8 K$ N# y) z7 F+ |! e <span class="close">x</span>7 Q/ a& \1 q. D! W# [1 N
<form action="#" class="modal-content">
% L- d$ B, c$ R' S <div class="container">
2 w$ h) U7 Q" z! P5 j# |' @ <label>Email</label>
D. h |( ^! b, h8 |2 l1 A8 Y4 m <input type="text" placeholder="Emmail" required>( S4 b$ \' }% J/ @& h J1 l
<label>Username</label>
; c) \# S3 O% g7 \ <input type="text" placeholder="username" required>; n3 u5 P* Q$ x8 y- B# [* v
<label>password</label>/ f9 w' O2 ~) _$ n# e0 H( K' Y4 Z
<input type="password" placeholder="password" required>
; h6 ?8 a( x% D9 b8 N8 Y. C9 Y <input type="checkbox" checked> remember me
3 |" N. E) E- r, s <p>Follow the policy <a href="#">terms & privacy</a></p>6 f5 ?/ Q! U; X5 n
0 O/ X6 T) Z8 E( x3 t0 u1 ?' {, c
3 K! W7 N7 u3 f; ^ <div class="clearfix">
$ q; Q& H9 }. S2 d& X) u: J0 e. x <button class="cancelbutton">Cancel</button>
9 Z* w$ ^7 D. f3 E4 ] i <button class="registerbutton">Register</button>
( u1 |- X2 r! g* q, a </div>+ p* `; g! R/ S# h
</div>
: q5 ^5 `2 ]; {0 _' T </form>6 D6 z7 U/ W+ S- m. g* ]5 G; x
</div>
' I! ?+ C! u% |5 Q+ f" w1 z: M, H8 O; i( q! [% K
. X" {" h" V- |' {# _4 m: G! F6 z$ U3 k4 B1 X0 g1 I
8 i A; p* q8 D3 [
& A0 f' V- n9 e4 Y) i& \</body>
6 D. d' |; P( I4 @: L" H" e+ u* v7 W* |% `9 x* V. U
</html>[/mw_shl_code], T0 t5 ~# I( S0 s" Y4 |7 _
|
|