|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
0 v K( @) k: s' m7 \5 _$ N8 X6 @8 N% P( O# R- ^2 t% y2 f
2 T% ~- ]) n3 Q3 Q' G" d
登录代码:: I. L( t B! F" Q2 l" G/ h
- d8 p; m% i0 p1 | k
[mw_shl_code=html,true]<html lang="en">' r' l9 d( X, Y) V$ Q
' t! U5 N6 R3 w
<head>1 R+ L6 b9 b8 D0 d1 l
<meta charset="UTF-8">% A* I5 W6 Y1 F) n. Q
<meta name="viewport" content="width=device-width, initial-scale=1.0"> d8 P0 b) ~1 U; e1 `. Y: |
<meta http-equiv="X-UA-Compatible" content="ie=edge">
/ r) a! `' D" m5 Y% n6 D6 L/ a8 C! z. c <title>This is a login form</title>1 E6 [" y3 E: W0 ?: {4 U
! i7 F! d" D+ K8 V8 n. ]: }- |' }
<style>8 e7 Y8 L1 p( ^- s6 o& ]8 p
.modal {
% v4 {: d( r1 W( n$ |0 D display: none;
$ p- g1 ^; n+ P$ @ width: 100%;
2 B2 r% {8 Z7 v+ {. b height: 100%;2 e) {/ C3 j7 D& j2 h
position: fixed;
- Y' m% p1 Y+ g2 L; R overflow: auto;
9 p: f' M0 L8 q% C. R z-index: 1;
. p' N, ^) y2 [& c1 n) [ left: 0;( |% ]) d* _# I0 [* Y \
top: 0;' b" d4 t ?) I$ O8 `# J8 `2 e1 f
background-color: rgb(0, 0, 0); T# `3 ~- t7 G5 ?' V' a1 ]
/* Fallback color */' D& _& G: g; T( P7 l8 K- a9 W( `
background-color: rgba(0, 0, 0, 0.4);
: k; F: X* w3 c+ }8 ~8 L( G3 i /* Black w/ opacity */
3 c; u6 t6 u) M! H% [( A padding-top: 60px;
- x) I: j" O$ c
: `4 C" t% ]# o1 m* V0 I+ p }
" ~1 E/ O6 b* c% W+ F$ N, v$ p3 L* M
.modal-content {
- P1 v9 N* W2 V! D& I3 t width: 60%;* D7 m7 N! O. t+ l% u/ z: S
background-color: #fefefe;
" U, M! }, I3 f margin: 5% auto 15% auto;
. u% {6 R/ b4 c q border: 1px solid #888;/ H4 E- D7 S: V! J) q4 S6 y9 N
$ p% H& T; K& t- q% f) w1 i, J! \) m }( _2 L3 t" w+ e! [7 {
9 @; t* c: E; i0 C! Z# w" u7 h /* The Close Button (x) */" `# n' G; d( u9 `
.closeButton {4 ^$ H9 Q0 S8 f$ i$ l
position: absolute;: @! @6 O, N9 J( a7 M: |
right: 25px;
4 V! g& W+ X) X8 S& D top: 0;
- I0 ?' i" t3 z color: #000;- E1 G& s q/ O& I
font-size: 35px;- ^( Y5 @: i% S
font-weight: bold;
# `) m: m, E: C4 B; c# D: w3 w+ [ }
7 O l4 L; U/ I) C1 k! o. F5 h, ]5 _# t# K) x- @
.cancelbutton {
: j% K0 t: g$ d% | width: auto;* z( _. l6 [8 ]! u* N* K5 V
padding: 10px 18px;
7 s2 ~+ B' R$ s/ H5 U( g background-color: #f44336;% U. }( A. j9 e1 Y4 F; j$ E
}
; }# U) b5 d! }/ d1 t9 v. L' S9 a
) r# x8 Y, _- j- p, F6 ^ span.password {
( |- d8 E* b: d' @ d0 }5 r- _; l float: right;
+ Y' m- Z8 K" | padding-top: 16px;! c; ]1 x7 s' o3 [4 r
}
0 s' s( }) U& }/ c+ J$ V) F: P" m* {) T# z
.closeButton:hover,
+ G% I4 |& Z3 D; ?7 o .closeButton:focus {
5 y+ ~% m* r- D" \ color: firebrick;9 y. q: |5 b8 t! e) k* x! ^, S
cursor: pointer;( q: w- A' {" X( S& V/ \2 s2 }
: s6 g$ e7 h# \- m
}& J8 \. o" O. G+ O- j
( U+ z) c# Z* J: f2 z, W
.imgcontainer {( F# w) f# L- g+ G" C7 H& F- {
text-align: center;
8 {4 H$ Z1 e6 h0 Z, ]/ E margin: 24px 0 12px 0;
0 P9 h r, o& R/ U6 ^ position: relative;
% }( n: n d8 S& f( k: O }
& p; j C" N5 X2 V5 V; t. \% G9 Y' T9 \' D( Y
.avtar {% h) \5 V) ?/ v* m/ B% Q: M* _* {
width: 40%;
! y& H2 X A$ L1 ^5 ` border-radius: 50%;& Q$ k7 W5 r5 Q2 Y) H+ F6 _3 h, O
}* m& }5 s* o* O" U& E& ]* Z
: P/ k& C X: R: C4 b. K .container {
! y/ L; y+ ^2 z+ a7 u. C padding: 16px;
/ x0 H+ D2 O+ X, G, I# B: U }
( `7 K$ S, R6 ?/ N
, w# r! ~1 k# d. `, H Y* ] /* Full-width input fields */
- t3 G! s" Y0 c w input[type=text],
G0 j7 d4 Q. d+ I. } input[type=password] {* l, g5 b0 ^6 J3 G% Z' A
width: 100%;
" H& P1 b: c" V: a4 p6 D% ] t! I; ] padding: 12px 20px;1 Z5 t+ h: o; T9 e
margin: 8px 0;8 g) ?. g% J( z# @8 U2 h
display: inline-block;6 ]& H; t7 [% n# g1 S; S# `7 A3 b* O
border: 1px solid #ccc;& F) I; z3 `& y2 B, U( D
box-sizing: border-box;& F5 q% ^/ b: ~- t
}
1 a1 b7 i# y. \1 w7 v) b2 t, |) k9 f) w! a
/* Set a style for all buttons */
0 t, O) {1 {6 R& Y2 _5 P' ~# m+ L button {
+ |. L6 m$ H2 r background-color: #4CAF50;
% J$ P% Q$ C" W8 t; O" E color: white;, [3 K: M7 b5 P8 ?' P2 A
padding: 14px 20px;# H, }# O# s: l$ f3 h& ^1 N. g0 c) C
margin: 8px 0;
* g. j7 {7 |: [ border: none;, {6 T, n7 \# ?' T6 L/ P
cursor: pointer;( h8 H+ u' C b# Z( i2 L$ m$ Y
width: 100%;: v" M/ u7 o' V' ^5 X" j% r& A
}
+ C: @4 ^$ D+ t$ T1 Q, d. j! s2 Q/ E4 v! [8 I X5 h. R H$ L
9 E w8 A, N; e; \- j0 Y* z; ^8 H) q button:hover {# j4 M6 o+ V% v& p6 `( y" w: H1 _; q: v
opacity: 0.8;
2 Q4 J) d; y) q: ]: ?. P }2 {, N' l7 H! j' R
9 ~6 q ~- a& k' N5 G7 P+ v$ E: Z+ P /* Add Zoom Animation */! f! f$ i! N, ]
.animate {) W$ U# [* r3 S: \1 _
-webkit-animation: animatezoom 0.6s;# H/ z# U1 l/ p' j2 Y
animation: animatezoom 0.6s9 B+ w4 _& }1 ]( `
}& B- k6 M# h+ L: f+ O; l5 k n. Y
6 V+ \+ D) D0 d" o
@-webkit-keyframes animatezoom {
; R" K" H; k$ S) F/ G) F) ^ from {1 D8 U1 {) U" `- W5 q+ z
-webkit-transform: scale(0)
9 {9 |7 L: }9 C: |2 c* R& [* ? }% \8 l1 H/ X) U" {" q1 A# O
u9 N$ `; F" D. p8 H" ~+ N5 L
to {+ h# n& j+ v( R$ R/ W: f1 U
-webkit-transform: scale(1)6 Z/ D. O0 e' c$ _' B- x Y9 z
}
+ H) Q V* J, Z* _9 l4 ~) Z }# x0 h e+ f: p$ K! s4 h5 f
- A( ~8 z! _* e4 z1 [. A @keyframes animatezoom {& E% G& h' [1 C0 _8 L
from {5 o+ q9 {$ I6 h- y" O2 ]) s
transform: scale(0)
) Q& W q- s; m- a }
E- {6 y7 H3 k# K# m4 p
* ]" a9 f1 \3 k to {
[$ }) m1 V5 \& |, `- |: p transform: scale(1); n' m8 S5 K2 ~# c5 I% @; E0 Q
}- ^8 \2 ~, k( H0 E
} W+ U5 b4 m7 \* Z
/* Change styles for span and cancel button on extra small screens */. P7 ?6 Y" d/ _9 @
@media screen and (max-width: 300px) {
& Q+ W7 o$ T; r# g- k3 ]4 { span.password {
6 V; R, E" l. P8 \2 Y display: block;2 H) S3 s5 H6 C% w8 b
float: none;
0 ]7 I" H6 [" y( j, c8 p }
; Y0 k7 Q, `% I5 B5 k9 X/ M
" z. b4 Z2 S8 ~1 B$ {0 z .cancelbutton {0 b$ \5 D, P( {
width: 100%;
, n: x7 w+ n9 W1 k }2 R5 X. b% @: @$ U1 d
}
7 E5 z) \% y Y1 u. Z# E6 U </style>3 \- {: w1 Z6 P8 B* M
</head>. W; m' c$ r7 C5 Z8 d; y. x" |2 ?8 }
1 ^& J/ |3 @! c+ q' {) U2 p<body> Y4 U# o/ @' R t" m, A* _
/ K0 r4 b) ]& W! i0 q
<button id="login">login</button>
$ g9 e0 U9 d) S <button id="register">register</button>
# g2 b+ H7 y/ J% G c( f1 P( ?8 l) b# w; m& w6 r9 H" Z
<div id="formPanel" class="modal">
% M; ` ~! p& R9 r0 ~ <form action="./img/logo.png" class="modal-content animate">& n$ F$ X) a* R
<!-- image -->
# q0 ]+ H0 O+ n. s0 g% A <div class="imgcontainer"># y2 X. d: F G
<span id="closeButton" class="closeButton"
9 U6 k/ [, N/ ?% p
& ]! M: ?8 z* ]8 b- ]9 ` title="close form">×</span>& s9 |& f) {& D5 p
<img src="./img/img_avatar.png" alt="avatar" class="avtar">
7 k& F, I6 C T& J </div>5 R! \: X' h" s; {0 o3 s
<!-- information -->
& g. G& c2 b X( {$ g" f <div class="container"># `1 Z; n2 w7 E6 u# |- z; J
<label><b>UserName</b></label>
. |+ b+ s) J$ a+ u <input type="text" placeholder="username" class="username" required>) v R; `/ L5 ], E# @
<label><b>Password</b></label>- `; p/ t7 ?* i. P
<input type="password" placeholder="password" class="password" required>
2 `; ?4 C! Z, T% T) Q5 P# ? <button class="loginButton">Login</button>
' u* ]' d, F" {8 C <input type="checkbox" checked>Remember Me! J2 O1 v5 U6 `3 S& R/ I; H
</div>
4 o- G; T9 Y# E `$ D4 m9 S+ z" c# |7 N" j* b. F1 p
<div class="container">
$ K# S5 U9 R4 X' J& Y! f2 z" ^2 s6 X8 G <button class="cancelbutton" type="button"
@; o, N" g, [9 Y0 m' B >Cancel</button># ^/ b. ?7 F# R( a7 w$ y
<span class="password">Forgot
% D3 S S/ H' Z' i* F) R <a href="#">password?</a>
/ {& f3 ~ P7 F4 ^- h </span>
6 d) T! Z" Y0 P0 l </div>
4 ?% ]: ~- Y p- i( V </form>$ x4 X- t* {7 u, ^2 b$ s! a
</div>
! A2 s; {1 q ?& L& \' [9 k0 }% U; ~$ w4 [
/ G) D- P$ S3 b: V) Y+ n <script>
: n6 G3 q" e1 X- R( u7 [; h# J/ s
7 }- F, Q2 r2 \; y( ~; V function loginForm() {) m D. W( h3 K, ~$ Q
var formx = document.getElementById("formPanel")
. u0 r& y6 b5 F; C) {- V formx.style.display = "block"
+ p' U* ~3 g) d7 }' c }. b5 m" \$ B7 a& k7 W& @ q
</script>/ [9 z- m8 t+ ?4 ?8 h' R, n
; B& s4 i# Z' A: L. Z r) ~
. g( ~, O. L0 c# h8 D4 _</body>
- |$ @3 E w- A: \# n: {5 M0 r: R4 h2 }; y0 X. C
</html>[/mw_shl_code]
- b' J- G3 K) |% v: {$ a3 g! u1 g0 C- ~- G* p. v8 q
2 E& i Q: J; n
注册代码4 D/ H! f* A+ x. i/ P2 b) {( U
2 `7 N ?5 U+ r! X[mw_shl_code=html,true]<html lang="en">' W( w+ E5 }, m6 x: B
# X7 S; ~4 o+ G, w; A7 j
<head>
2 I- J2 L8 C6 G* O <meta charset="UTF-8">( [6 \6 V& [# h5 A7 t
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5 @! \: u, p5 ?8 T/ E( _2 U- H <meta http-equiv="X-UA-Compatible" content="ie=edge">
& u k3 {3 I" y) q <title>register form</title>5 s5 Z; `1 J9 k/ K Z6 D& v
% w5 ?: ~3 ~, p& n2 ? <style>3 M5 P' ~3 p+ A; ?9 E
.panel {4 I1 u- I7 U/ P7 c& M
width: 100%;- e$ B K& k3 t/ r v4 Z
height: 100%;
V" `9 P, i! s background-color: rgb(0, 0, 0, 0.2);
( {. [$ f! S! t- b' c i padding-top: 30px;
0 F; `& {! A5 C. I6 { overflow: auto;
& p0 w6 q1 E3 q! t- D7 O: Z- C position: fixed;
5 k3 r U% Q3 S- H q left: 0;# }" e& g8 e# v" |
right: 0;
! }, L0 F; I9 O; S) ] O+ h z-index: 1;3 l g$ X! \) |6 q1 Z; `2 W
}
8 s& N- b- w0 C6 ?5 R: F. v& k4 n; h- ?+ u& a6 A, k
.modal-content {8 h8 i1 C2 c* {& Y! `7 g
background: #fefefe;) y6 D0 j. L8 o
width: 60%;$ F L2 l; v1 C6 d. I. G- H
border: 1px solid #888;+ ?" B& S4 C0 D) Z k
margin: 5% auto 25% auto;
g) w/ R! l) @" y1 f4 {2 ^& G/ t# J: N$ D2 |% m
}( B) D0 [# f- x
. z3 S6 ]) D: K% `! v4 ?% Z3 U
.container {* t) u9 Y, I% P
padding: 16px;
" ]; { P; z& P2 T: R' ] }
" S t. E8 ]5 J% Z8 _+ p
; g( k2 a+ ^% X. S; h .close {$ B, n" {3 V9 I7 o+ K8 e
font-size: 40px;- ~( L% h; d. s5 D$ H
position: absolute;
: q, s* s% W& l top: 15px;
0 J8 t) w3 W0 k3 i( z right: 20px;2 X5 I3 e. B- c& m K$ g! V
}
% \6 @- N O4 ]: w1 I! l
' T: r! b" E1 o8 H .close:hover,( ^, L1 C6 N, v h, K
.close:focus {% V6 i2 z, e. G3 U6 x
color: red;# Z, A0 @ P" L6 F4 {8 E
cursor: pointer;
3 @/ O$ c. i& L1 Z$ T4 @# H5 ] }
* u, z* {, k: p1 P+ b: x$ m+ h `, _, j3 z* {) _
input[type=text],
3 u4 @5 e6 R {0 j8 B* K- W input[type=password] {! p v n' |6 {8 N+ Z( }) E
width: 100%;
7 w- b4 L) |4 L& s, m5 \: W" S5 f padding: 12px 20px;
: I6 a' [' e/ ~ margin: 8px auto;4 e% j9 f/ z# V& ~" ^
border: 1px solid #cccccc;
5 K& W: ^4 l" [2 Z. b. G display: inline-block;7 t5 j, h" w, s6 U/ v& w+ M
}& j6 f' t) N' T7 t. k' q
" X, K9 x) `+ `* S button {8 |/ j: g0 B- H' ~. E6 T# H' J
background-color: #4CAF50;2 y/ ]% a6 r/ \; S9 a: \: G$ O0 o
color: white;
8 x" [: m5 F3 ]* l' X7 n padding: 14px 20px;
# y4 f0 k; C7 ]& N$ }2 m% c* A margin: 8px 0;
' U8 [4 |& U( u( m. J! C: { border: none;* ^6 L9 Q* W8 m! W( E2 L
cursor: pointer;
8 O P: h, O5 u* |$ C4 j width: 100%;* c8 s# e; q& i9 U$ `4 t
}
0 m7 n% u; h/ _$ r3 u% d* }. m& s; x( y, f! o
.cancelbutton {
* b: s2 t5 y; ?. [& ]( r padding: 14px 20px;
% e5 B6 P6 I3 R$ [3 X d4 u7 g background-color: #f44336;
L# J: F% f+ K8 Q8 T# r }
6 A4 A e1 z: u3 l% R
# g) s: Y' y4 Z' A- L' h6 d1 w .cancelbutton,
0 s2 ?- g0 r1 P6 n5 _9 n' n .registerbutton {
1 l( @+ N: p) s7 _; G3 k; R8 L. F float: left;9 _1 l g; _( k& N9 H' P* T8 x
width: 50%
6 A; e& m+ V/ u9 H& r* u, u }
; }% G0 ` e/ b
% `& H4 d3 F0 A; d: Y1 g .clearfix::after {0 R& B# c; z. o% P3 e: a, V
content: "";
@0 i* F' _' v/ f& Z' H1 S/ Q clear: both;
$ s. R8 Z8 `) {, Z6 x2 m9 [3 H6 \+ p display: table;
8 u3 I# z+ G. A }
. U2 H! S' R, `3 {, ^, T/ t7 S6 g </style>8 O! \2 K4 Q+ A. m4 D+ {6 r
3 ~/ r' m3 R6 R5 B9 _* M
4 Y: x0 j6 b4 @1 Y- ?2 S0 g4 f! O4 y7 E1 `8 e
</head>; `6 K4 Y& O: i$ m/ B z7 F
- u& M' {7 c/ x<body>
/ ^8 q9 j- P9 l# v1 n* K) P, _+ y: o. E4 [9 A
<div id="modal" class="panel">6 s5 c2 C# K" \6 }2 G
<span class="close">x</span>' L/ [1 N0 @) I7 q5 X; e, L8 _9 \9 `
<form action="#" class="modal-content">
- K6 F( y0 j" K* n" ?3 L* Q <div class="container">
/ U. X% O' w4 M6 P: v <label>Email</label> K) E. G2 q$ U0 f9 E- b
<input type="text" placeholder="Emmail" required>
$ o0 U- v+ K+ P$ p4 Y: N; g0 ? <label>Username</label>
$ x- H( f ]0 t9 d7 _ <input type="text" placeholder="username" required>
* X$ ?/ q" v# D3 t5 W7 V <label>password</label>
4 v+ w+ ^- j# X/ S* ]9 I <input type="password" placeholder="password" required>- F5 L. s& y& v9 q. w/ \/ i
<input type="checkbox" checked> remember me
% E- \" y, d, O D9 Z1 ^5 E <p>Follow the policy <a href="#">terms & privacy</a></p>
4 F0 b5 l' Z8 y. O
" m& }9 q" i* K' q# R* }
9 d5 R& W! j: K$ K: y* s! W1 I <div class="clearfix"> }) w h& L! [5 P2 j9 n
<button class="cancelbutton">Cancel</button>
0 ^& X$ v. a u5 q <button class="registerbutton">Register</button>
3 b/ Y& m4 g( r </div>$ Z/ `) p) ^( f6 Y* V
</div>
8 t/ @& t2 T9 N5 p0 y9 N </form>" i' v# `4 G3 ^% d* H
</div>2 K9 G. J& v a
. c3 _% G; s- C+ _3 O
$ Y* t, L5 q- A: A% ~% b1 G
; E% D4 w+ z3 \- E' m4 p% A' @& j9 T! t& ~/ O( p
+ S( ^5 U+ f8 l( y</body>
( ~1 b, E* s! D+ }& j! q0 y K! w9 a5 V' A8 a
</html>[/mw_shl_code] ~3 ~$ M4 ^/ `5 s
|
|