|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
1 i1 p& y% C8 a- ^
+ u. E- Y. o, U
8 h( n$ k2 f2 W6 l- V) B$ G- ~
登录代码:
" V3 i# r8 V( K0 K5 e+ w( k8 w* E1 [9 J
[mw_shl_code=html,true]<html lang="en">0 j! k6 X) l! H6 Y
+ v$ r9 X$ z1 t<head>- ?6 l& d" s$ Z! S& l, r5 z
<meta charset="UTF-8">8 T4 ]/ T5 t( ^3 Z) \/ F
<meta name="viewport" content="width=device-width, initial-scale=1.0">. G& `# \8 y8 u8 r
<meta http-equiv="X-UA-Compatible" content="ie=edge">
- I) o7 N7 C ]$ f <title>This is a login form</title>2 i) l, d* Q% S; l$ c
( y4 u. P5 F, p8 x3 W <style>
0 \" f- P7 E- {, B X- k7 m( j .modal {
4 u9 j% b: t$ m9 |' J X display: none;
' Q; K2 r0 W" o width: 100%;( a# z( H& L$ {7 u! t
height: 100%;- n; q9 y x+ P! k. [$ R+ Z& T+ x. L
position: fixed;
" \; z; T& h, m. ? overflow: auto;
( m1 p1 n9 @6 s8 H+ ]3 b z-index: 1;/ G/ T/ {, Y) p4 ~$ F* f3 }
left: 0;# I' ~4 J4 d ?9 L
top: 0;
) R+ l) F3 F! R background-color: rgb(0, 0, 0); ^: S' v" e* f7 E1 f
/* Fallback color */! g& I1 V4 F; ]( {, w. X
background-color: rgba(0, 0, 0, 0.4);" M5 ]4 o: L$ z9 B! ^2 n0 o
/* Black w/ opacity */, \3 k# x' O2 H5 D! Y7 v
padding-top: 60px;
% Z: j- w) @! H r( N& \6 x) d6 W* E/ S5 _' r6 M+ o
}9 c( m- Y1 q' D6 _
! r" K v, @* }4 r7 ~3 E% \# h .modal-content {( S- H" u6 y& H2 k3 O7 ]; y# D
width: 60%;
$ \5 |' j. U- ?( \0 M background-color: #fefefe;
- \" a1 i; @! B- @: a- }! x, | margin: 5% auto 15% auto;1 P O" W/ ^: k* _; Q
border: 1px solid #888;9 ?4 D. t2 T S1 N( D1 d
l5 I, t7 [% h' o: p1 ^/ O }
# x, t! W4 s6 _5 U3 d$ f( ?2 @# a$ C8 [
, P% N' N. D/ Q /* The Close Button (x) */. c! b8 p( X+ g9 f
.closeButton {, P/ q/ b5 k. h; d3 M: N
position: absolute; {& G' G, i& h! W$ p- B
right: 25px;3 J% }* R' O6 N# i; N' G
top: 0;
- O8 e! V* Q) i' I7 j- y6 o5 H color: #000;6 ]; T, e& M8 E0 H+ ^7 P1 {
font-size: 35px;5 H+ Q5 a% W1 g M2 ]- N+ G
font-weight: bold;
- H. o: y, I& r' G }
3 Q" u+ @7 `+ i! B* ?+ Q/ r8 a
4 r. K; X% x. ]9 b! Z2 X .cancelbutton {* h* q0 A$ T$ b* X
width: auto;
/ X S+ [$ K6 f padding: 10px 18px;
4 K; t/ m9 u9 g background-color: #f44336;. u/ q( {& B; a0 D1 a# F
}7 A9 l5 {7 D9 w- A1 R! N
& r$ W1 ?' Q/ W2 a e! B' v8 F span.password {
1 |% c; v: H$ u4 }: O2 \% H float: right;, z! a' N/ Z5 Q( E9 R3 V
padding-top: 16px;/ X- T; x2 K3 T; r" @
}
8 F- ~' y# r: f; Q4 a* J4 J& f8 f
8 F; m9 Y0 J( ~8 m .closeButton:hover,
; |* f$ a. `4 x& l/ p: k E9 u .closeButton:focus {
3 I H: i0 B- j. G color: firebrick;
- e. T- _- I# [1 O/ M4 ` cursor: pointer;$ W8 e1 V6 m4 ]8 c
" u$ s# Z9 a& F2 U# G8 W- T
}
; H5 a% Z+ d3 ]0 o
9 X6 S4 E0 }0 y5 r( l6 c& K! C% w .imgcontainer {# i6 E$ A0 p$ Y- M/ z3 |5 v
text-align: center;( o: b" x9 E# z! @
margin: 24px 0 12px 0; E9 v1 V" O q- E- M: N1 G7 t n
position: relative;
- }) C2 H) R8 d }& a) r) g5 D/ B$ h0 @ i# B- z
( S/ D4 T! L1 ] .avtar {0 `2 ~8 @9 G2 a- h' W3 H6 T
width: 40%;( |! W( y d6 F8 e$ x
border-radius: 50%;
6 B( V7 Y0 e) H+ o }. I5 @4 {9 j5 \) [( W
- u' o( Y \1 f& H' e& Q+ Z .container {8 C5 B. p# ?+ B2 b' v# @: s
padding: 16px;
" i# m$ w! E8 ~$ C }* l6 t# ?" r6 j5 h: h# Q/ q
, j4 M& E- O0 a4 q0 Z0 v+ v2 n /* Full-width input fields */
" T& [0 y2 |) Y; O input[type=text],) @) p# b6 w' \8 t6 V! w7 H; M
input[type=password] {! b: B2 O) c, [6 t/ N
width: 100%;6 n: q4 s6 j! a# z: G
padding: 12px 20px;
: u2 }9 S$ P! p" `' X margin: 8px 0;
4 c1 D u& z: M, S" i display: inline-block;
) }: m: n6 G* D# r5 a border: 1px solid #ccc;
# v; g! j# w# K- i box-sizing: border-box;
% W( ^& |0 j6 Q4 t( G, M }* t7 W# o. b% G
% T: B: k3 k) I; i" l( ~ /* Set a style for all buttons */2 O$ E+ d* q4 Q4 p0 ?, f9 g6 T7 K
button {
5 |6 e6 _" u9 G+ \; Q% F" G background-color: #4CAF50; `: k8 }2 c5 y' Y6 X
color: white;
- s. d3 v5 ?; T. P" Y' O2 u padding: 14px 20px;
: K0 y8 D- X5 t6 S: o margin: 8px 0;, J6 @) W$ M# L& o6 I
border: none;8 B: L1 C' M$ N' J1 P1 E, p3 ~' X
cursor: pointer;
6 g1 h; ~0 O2 e( x8 c( B) w width: 100%;
+ z" x) \/ M2 `5 N$ L, M) e }) L0 I3 t% Z! u# M5 |; b
( U$ |; C; V, y) K$ I
3 x/ e3 J$ c: c: _' m0 e button:hover {# c/ q6 h$ i: J& H1 B% O0 S; o! E
opacity: 0.8;
! s5 x, ]3 |8 p U& n }$ L, q2 O$ X1 o$ ^% N C
0 N! ]( Q: F& ?' _1 c& b2 [ /* Add Zoom Animation */0 G% F4 ^, q: N+ Z1 u
.animate {0 k( X9 u) s& C& Q. m* x; J
-webkit-animation: animatezoom 0.6s;
: V4 ~7 n( v+ A1 } animation: animatezoom 0.6s
8 |( D1 E+ C; |$ v5 ^" b4 ^$ j }
3 ?5 K# R, r9 _ W E8 p2 S
4 R0 L: g) E* w: K @-webkit-keyframes animatezoom {5 i ]4 X: J* F* ?
from {
( p; U+ K* f8 f2 ?$ r -webkit-transform: scale(0)- L# t1 O+ j& z9 r* O9 O% e5 {
}7 @* z* |# I- H. m6 F
7 q5 c1 w! V' d5 ?& m' ~
to {
* c3 u7 I T9 L* |& d) U( g5 a -webkit-transform: scale(1)
: N3 M. D7 J4 j }
& M( g! ~ I7 f5 y/ E7 j# o# b$ f }
- k6 {! s0 a+ R1 \' x2 \) T/ P* F X" j* {
@keyframes animatezoom {
3 Y# F' z9 H* ]2 n/ ~3 v- w, b, \ from {
4 K$ X0 {) U X transform: scale(0)) H) b6 M2 f' ]3 b
}
# u0 v, |5 ?1 g/ h P4 Z
; T7 Q1 s! t2 Q& C6 Y+ R6 c' u to {
6 u( T8 [8 {# |( r, g transform: scale(1)
- i0 e4 |& {3 y$ f }
+ I3 W* ~% U- D, S }! K8 `- ]. h |3 z$ f
/* Change styles for span and cancel button on extra small screens */( o/ W. o& s1 r# b: J
@media screen and (max-width: 300px) {
, W% k" k4 U& c1 X8 A: |$ b' U span.password {
6 x: S* X* d7 N: W' _- g, { display: block; G" V+ X; _# q0 ]
float: none;
# Y; C2 y4 y3 }- a/ V' v$ ] }" ]0 G% K! M- S5 R5 G3 [
0 d2 g Z+ s7 ? h6 ? .cancelbutton {
, t6 { i. P; [' o- ], T width: 100%;3 O( X5 l0 E7 E- T% _
}
5 N) N6 ?5 Z+ j9 i }
- W& z( z/ F! C/ Q) I </style># v4 i' f5 Y' v; ?5 j5 [
</head>
& |* S5 Y0 S9 ^. D
' J3 j$ _4 p: [4 k7 p! Z6 K- v0 ~<body>
7 A2 G& s. C( |! o5 f' X! i. Q8 N6 k+ r5 C3 j6 T5 ~0 u
<button id="login">login</button>% P2 R) l/ Y3 p# B
<button id="register">register</button>
7 o" l6 d8 J* g6 @+ W% w; M9 D9 {$ Q( h' a% R; E- ?
<div id="formPanel" class="modal">: e0 x( E. C* R* C/ z0 W, S5 T
<form action="./img/logo.png" class="modal-content animate">
" @0 |( ^+ ?2 S4 Y: d9 R <!-- image -->1 U8 r; t1 ]' X! Q
<div class="imgcontainer">4 l" a1 q l: Y% K! @) Y
<span id="closeButton" class="closeButton") n3 D! K( n5 t6 n
7 L* ]1 N) y/ I9 n
title="close form">×</span>
8 _; h9 H/ X! S) D <img src="./img/img_avatar.png" alt="avatar" class="avtar">
/ i& N" o3 d) a0 v' O- M </div>: T' T9 r! ~8 _0 o
<!-- information -->% D2 y4 m6 A! ^$ V- n: _0 G2 k
<div class="container"># i) e3 R2 d# v
<label><b>UserName</b></label>
% L5 v; O4 E, l$ X <input type="text" placeholder="username" class="username" required>, ]) b8 s- B# v+ P9 [: ]" Y0 X
<label><b>Password</b></label>. M, K' k7 i* d1 L. Q8 v
<input type="password" placeholder="password" class="password" required>, a% {: @# T! H6 o" A x7 `* v
<button class="loginButton">Login</button>
9 A; q* b/ u/ c* X) N' d <input type="checkbox" checked>Remember Me
) u5 @0 u6 `3 r& U6 q' h" s/ ` </div># P+ H- {8 b1 L, @" N c0 R+ ~
1 G1 C8 w+ h- i
<div class="container">
7 {$ h/ x- P+ ]" c# L" B- c/ p: [ <button class="cancelbutton" type="button"
) O) L& }3 ?* M: L >Cancel</button>
1 a* P' t# k9 G <span class="password">Forgot4 s8 F! \, m) S' C" p g- e
<a href="#">password?</a>
; u+ ~. Z6 |$ ~; A0 u9 A </span>3 b1 X! W: U1 o# d( N8 ?" @7 V
</div>" Z9 W6 B+ K% G8 o9 G: A/ i r
</form>
, h- O- t' D( t" W1 q- \ </div>
- j) ~& |" X- y
/ ?* B3 x6 q% A
' `, m/ M" a$ r1 Q5 V0 ~3 J* y <script>' c6 V! S! w& V6 {' d5 y" Q+ d
# j7 i7 A; s5 O6 X2 X function loginForm() {
K3 j- o6 g* s5 l9 ?- f4 D var formx = document.getElementById("formPanel")+ G0 D0 J7 {; E; a3 f- \5 K! M
formx.style.display = "block"& n a7 ? A1 ~" z& i
}1 U- q9 d" M3 S: C
</script>1 ~+ O! b5 S: t& h' u( \
. Y7 ?3 V# o/ a3 \9 Z0 F- `7 T' P
" x% l! U5 X N6 h</body>( f" [$ K8 A6 }
z/ d: C' k( |( J+ d9 j! G) v</html>[/mw_shl_code]
c! M. h O3 j7 ^9 T& n( h, F9 _! N+ j
# n/ ]; P0 I) E注册代码$ Y ~+ ` z1 N P8 L
& x4 n/ ~7 F% E+ [. \+ @
[mw_shl_code=html,true]<html lang="en">9 C) P5 r# Z! N5 | j7 y
" t! b' H- Z, t1 B3 M% ~<head>0 C6 n" t/ U: e4 u% W
<meta charset="UTF-8">
" l9 D# N/ f/ K. C; w <meta name="viewport" content="width=device-width, initial-scale=1.0">: [1 Z$ o6 _- t! L
<meta http-equiv="X-UA-Compatible" content="ie=edge">1 y3 W$ g5 I1 L9 x
<title>register form</title>
2 K B: ^: y2 E) P
3 X3 J/ ^7 [! j <style>' ^: j0 @7 ?; k; C; J1 I7 _ t
.panel {, H+ y- I" N+ |
width: 100%;
% T K# W- s3 r+ X, A0 _+ P. _& { height: 100%;5 A6 b" I" [1 T# o E
background-color: rgb(0, 0, 0, 0.2);9 P7 Q! p0 }( R4 ?7 S' e
padding-top: 30px;
: t( G) x* |" P3 J9 ^ overflow: auto;$ W9 f* V* `5 V6 M# g
position: fixed;6 \# j- f2 n3 g% b$ ^% k
left: 0;$ I2 }0 X' `( A# D' Y% Q
right: 0;
0 v! f2 s: g6 S' P& [1 E4 p z-index: 1;
{; B) Q& X L$ \8 o8 u }
, a# Y# U: |" O- h, y
F" Z0 l* G, r5 v6 \ r# h5 h .modal-content {( p& M- Q& h' Y, M8 O" o' D
background: #fefefe;! ~0 b, i" t/ T
width: 60%;5 Q) R# |- ~7 U7 _ s' u
border: 1px solid #888;" p3 a" _. \6 k! g1 l4 N$ V) _8 P! n
margin: 5% auto 25% auto;* O8 A; Q6 f8 | y
: C, {/ {6 z7 U& p
}
% T- z" [% w+ i, u/ S; O5 E+ L |6 g; J
.container {
+ \& Z' R$ b$ T Z padding: 16px;) O }# M# i/ h7 a B3 r
}
l* a1 _ l0 l- Y% m- G/ \+ b: }" ^
.close {
9 c9 r2 b7 F8 ]2 e# T( O: ~; ^ font-size: 40px;5 U2 p1 K7 x8 b# e
position: absolute;
. H1 c# n* `* R5 ^% a' s5 w top: 15px;
$ i6 {' V. p0 _4 v8 p2 S9 F right: 20px;' r2 q" z, u) v: W: v: `: c) n
}
9 g' I: V. w; j, D z3 E! i% v
) u( E0 L6 }& i- k" k$ ^, e. n .close:hover,: Z/ x d/ q2 X; q2 \! `) I& D+ e
.close:focus {: \0 P- `( h& F. m- R8 h# t5 V
color: red;
# g6 x+ j# l8 f2 M7 `; y cursor: pointer;
4 b( W9 A# U1 I4 ^6 M }
+ k/ M( O1 g" [7 t: K2 X1 X* E; ^3 _ ^* l6 z
input[type=text],
+ M5 K n0 L6 [9 X6 H3 x" ?6 ~/ L+ W input[type=password] {
% c6 N& H2 X3 D; C1 A: O% o width: 100%;( T. v# }) Z! U9 T
padding: 12px 20px;
# W3 U/ B1 {9 c6 {: P6 Y3 L4 ^ margin: 8px auto;
! s& `) g% C6 Y border: 1px solid #cccccc;
' ~$ Z4 s9 D0 S9 X: W# w) e# ~/ s display: inline-block;7 q9 Q6 [/ B, I. q
}
# |0 O5 G" N: [, [
' V/ `' x: q. A button {
2 q2 ?4 t7 \- N b background-color: #4CAF50;
) L: k+ S! g2 Y: ?, h5 H color: white;+ K4 P S# v2 w3 H
padding: 14px 20px;& V2 }+ X M# W
margin: 8px 0;2 S! h; ^0 z1 R( P. R) W& X
border: none;2 O, {5 \7 D4 z! Q# i3 ~( f/ a
cursor: pointer;
3 n: V$ k6 s1 a# l$ K width: 100%;4 U* G! {8 Z n- {# q3 _
}4 R7 J% H" Y, K
! N `+ m& P0 @$ f .cancelbutton {
+ d3 I1 Q! s+ z padding: 14px 20px;
: K& ^' V7 D" [% Y. J background-color: #f44336;* W- f3 W& m& A) B
}
/ c- {9 p7 t( D0 p
* b: A7 f# L* R& U0 K6 y0 `$ Q# M .cancelbutton,
# p5 y% R' K2 c" t0 G8 t, q% C .registerbutton {" d( a. |: g/ F b. y
float: left;9 U! X& d- A. t- x4 E" F2 p, q6 V0 m
width: 50% W- `' a, Z$ s
}0 `: @1 ~# b9 B: D) ?* N
1 o' y& d$ K. i4 o# H* O: [ .clearfix::after {( v+ P0 X5 j1 g* g
content: "";
5 f9 T9 D _# O clear: both;3 O0 M! }) c" h5 b. @
display: table;1 j" C! V. V" X- H7 M! f
}
' ?* i7 T5 t' x2 b! N </style>
' l4 g/ P# X3 f; x
8 ?) M' Z% X% r0 Y' J, s! ^3 B
: J+ ~3 V4 N6 `! {
: Y3 X `1 M/ o- n0 V</head>
0 v+ ]: k- K U0 D8 ?* X
5 d$ B: x3 o s f<body>
+ G6 }4 }# s: \8 ~$ b8 L" `3 Q; z/ l+ k5 Y- A: e/ ]' g9 I: U
<div id="modal" class="panel">) H* z! U3 V; H% @) m/ i
<span class="close">x</span>: A3 p5 n7 v+ T/ r) k1 z. f8 a
<form action="#" class="modal-content">
/ s- |9 K1 [! V* p" H! d: v <div class="container">) y2 N( p) g2 u; u9 X; V S
<label>Email</label>
, W0 \" U5 P; f <input type="text" placeholder="Emmail" required>
& }( p# D* F, Y# G% | <label>Username</label>( H! z/ u/ U7 s' g, X
<input type="text" placeholder="username" required>
4 B E- V7 {, B( C <label>password</label>" G, G: t' ~0 X, C
<input type="password" placeholder="password" required>' Q t- l$ d! v
<input type="checkbox" checked> remember me" \! p0 }/ a( N2 c4 z$ @+ {
<p>Follow the policy <a href="#">terms & privacy</a></p>8 D0 G3 K- w, A& H: X
5 t2 d9 ^- @# L, E; U
+ c0 u; D% |8 q4 u <div class="clearfix">% Q8 q) c. r0 m# h; f8 h! W
<button class="cancelbutton">Cancel</button>" K- V3 e% d) a* O h4 P
<button class="registerbutton">Register</button>
1 X0 o- F/ J- ^3 P </div>5 t& [# e$ K! ]. w; Y5 t
</div>
0 D N# Z, h! ]* m+ c/ S </form>9 o# m, A" K" y7 b) g# [8 J& x& n
</div>
% `' S1 f7 a, b) b# m7 L; f+ R0 o0 B6 c6 d ]* }* X$ i
: W' R4 T W6 [2 U, H2 k# {( ?! E
/ ?1 g# L$ t7 M
2 A4 C# {( \2 b6 D9 H. c2 _" e
1 t$ ^* E' }9 C% z8 h
</body>
! L% @% X$ H" O% ?$ q0 n* G& |" G* N4 W6 m0 l0 L% \+ i
</html>[/mw_shl_code]
! y3 S8 e& T8 X |
|