|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
4 f, g4 G$ f1 U1 G5 o
5 H4 C/ s6 f" H5 v: ]5 u
; m+ I) |, H7 r7 @' ~: ?4 u
登录代码:2 V$ @! ` s1 [% O: u9 S
0 ], T) [3 }' u! D9 |[mw_shl_code=html,true]<html lang="en">0 p4 c- I) G: k F% |$ V
$ }5 k: w( h: h' t! K/ `( e
<head>4 w, y$ p; E4 ~
<meta charset="UTF-8">
' l6 `8 a( @1 h" P- I% i9 c <meta name="viewport" content="width=device-width, initial-scale=1.0">
$ \: I8 l/ {" r* p8 R# Q <meta http-equiv="X-UA-Compatible" content="ie=edge">
/ n# X0 q0 Y7 y <title>This is a login form</title>
3 s& t t9 p, H2 p* d. t) s6 L# q5 O) V+ W
" u& V# _- i) r s <style>" j( v7 \) r- _2 W
.modal {6 r1 Z! W5 u' j& V6 C' h* C1 z" T
display: none;
: `5 p- Q- c2 C# I1 R! s width: 100%;: ?0 I- Y$ G& w$ j+ C. y' ]! Z( e, ~; I
height: 100%;
3 Y. I$ e! H4 P$ b4 J position: fixed;) Y. L' { D6 I7 d! H6 K" W
overflow: auto;
7 ]1 X, \! |6 z+ Y3 ? z-index: 1;7 h3 ]+ \1 z* S) ~/ ^& D
left: 0;3 w3 J, Q! z. K" q, A# w! v. c' {* I; _
top: 0;
* O, k8 r6 R7 [ background-color: rgb(0, 0, 0);
; \3 ]8 \9 W( P* W /* Fallback color */
, |7 G) y4 j, [7 ^6 Z background-color: rgba(0, 0, 0, 0.4);
" |6 g# ~! @: r- h4 A% R /* Black w/ opacity */) T5 G9 U# Y, H3 Q) ^
padding-top: 60px;$ E( q5 o5 c+ T# X. q& {
! L: N& T" Q& r6 A& B+ f1 {
}& o: }1 T( \; R( K' V/ h" t% h) k
p, W/ L. }: B. |" \ .modal-content {, n O5 @+ r6 [. Y2 g
width: 60%;
: t8 q# k5 K. ?2 W" o background-color: #fefefe;
5 T, f# g& @- P# `" X( @2 Q margin: 5% auto 15% auto;
& f- t% X/ n. @. z1 S border: 1px solid #888;8 ~) S' B& o& X4 u
/ z; h5 U% E" Z- r; U
}
) U8 w, D0 s% b- Y& l
; t4 x+ b- ^8 P/ Y% f /* The Close Button (x) */
. a- \1 S x; I$ |2 u .closeButton {6 d: S- R; E1 c- C* D, @4 ^
position: absolute;/ u# d( Y6 r3 u! A2 b
right: 25px;% a2 B: K+ z, v
top: 0;# |" m& g& ~& e# U: K5 _
color: #000;
, W/ K& C# r- D: T1 A6 v' { font-size: 35px;
, g5 {1 I+ R) M" K font-weight: bold;
/ c# u, c, J! a$ y, ?( _ }. M0 X. j4 V8 S8 ~/ M
* P1 a% A n( Z( M6 x+ H- p
.cancelbutton {0 c! C' |( v0 M& F9 D3 n( M
width: auto;
& Z8 O. B" }- h7 Q; E. ?" r padding: 10px 18px;
& S; I- u# s/ P6 Q7 f+ e# x3 ~; O background-color: #f44336;
( C9 m8 f' x3 `( }" y& t2 r }# J5 F7 o5 N p1 n# v
% `& i: k1 {6 y b* y% x span.password {: r: B+ s5 z+ N# D# Y% H: V [
float: right;
' J' J j! o1 V) e! \ padding-top: 16px;
/ \! D' }3 c4 U" ^- T. B N }
X7 O/ _/ |+ F" I2 g
* t; A0 G; M! x/ n* r .closeButton:hover,
1 Q& q$ i7 I; d) L .closeButton:focus {3 x4 L' \0 j$ N
color: firebrick; \: L/ y9 g4 u: H
cursor: pointer;" n6 C. x1 c0 ^) ?
, k' H' t6 i) z6 B ?
}1 Y5 W% _6 A2 F% o" y
' K2 F; ? ?1 I S' |
.imgcontainer {! ?6 d: `8 T7 W, a M
text-align: center;1 C. W. v6 a* i; H0 `' r
margin: 24px 0 12px 0;* }% L1 @0 v7 ]; R2 P3 A
position: relative;* w- U% i6 I6 |5 [. Z1 `$ h- J
}
. U; K4 T6 w4 k/ E4 u! g5 c9 g1 M9 \4 f% R$ \% a/ }
.avtar {1 I# K' G0 u# Q" m ~
width: 40%;. h! O7 S: V$ a3 j: m& s( X
border-radius: 50%;' a* I$ \0 {0 R8 ?# r/ M) k+ e
}% W, {" U! l9 I! B: a* g& r
4 K' f0 U/ r/ L/ H
.container {+ u8 K" x( a8 @. i
padding: 16px;
- `3 H& [4 B3 @ }
( Y: u) _* N. f. @) a0 ]' u
* Y/ y- ^) O% l5 \0 g" O /* Full-width input fields */
2 c! Z' M1 w( E0 u input[type=text],/ O$ r- M& r3 e" ^& T; a
input[type=password] {
0 v0 L9 C1 A* d& F width: 100%;- ^; E2 G: D, m! |
padding: 12px 20px;) M! R5 {% U) m
margin: 8px 0;9 C O! o! }% Z& ^
display: inline-block;8 r( u, z6 w7 c( b# O/ Y% g
border: 1px solid #ccc;
5 Z: j# \4 S1 M* D box-sizing: border-box;
6 d8 }# V- @! _, A1 S; h. G( w& W }
" W1 A( W( S! X4 V/ R* r* {" B1 ~
& M# P2 [& G( A8 Y' U9 `, B /* Set a style for all buttons */8 k2 @( \! s0 B. c+ k) c
button {
) p( b v# d3 F9 o/ c6 E background-color: #4CAF50;, {# O& u# ?, z9 P% \% H3 [- m
color: white;
8 T+ H( ^1 Q5 n padding: 14px 20px;
( I( X( p' f7 z% h* Y margin: 8px 0;
4 u3 C1 j7 L, |: o' g% \, a border: none;6 c: p3 M( j9 M( y
cursor: pointer;
/ S# F6 Z" u7 g3 _* Q width: 100%;
, n, R0 y7 y7 Z- L& l }# M, i6 K0 q. @6 F
9 E5 f2 \6 K2 `, ^1 M" T1 X8 r0 r
5 A" g0 f' m4 X5 x; M. h# s3 s button:hover {
# ~' `+ C* J9 `" s' G, ^ opacity: 0.8;
; [0 T$ j$ h% X3 P, L0 G, x }3 S; g3 X2 Z5 z9 m N$ M$ F
0 q" x/ L" m- {7 e" {
/* Add Zoom Animation */
; R: }$ p S3 S% T* S .animate {
% ?+ G) o0 H4 Z+ \+ C, S9 x -webkit-animation: animatezoom 0.6s;# w( h7 ? H( D& D% B
animation: animatezoom 0.6s7 ~* ~% v6 r6 k/ U: C
}6 V7 b5 b! u4 B! P }$ {
, i' H3 N/ S8 s* o @-webkit-keyframes animatezoom {9 O) c$ b* g# E( Q
from {, S! g5 a( R: ]! i7 p$ \' G/ Y3 T" C
-webkit-transform: scale(0)2 s+ Y% Z# z) ?) G* i. ~1 B7 a
}
7 S. f. M& Z2 Y ?* m/ b% c, [1 f# o0 `- h0 l$ `
to {& m/ \2 y% S4 E! A) @+ x9 _+ D
-webkit-transform: scale(1)2 _+ s' s' v% S' Q& ~
}* i$ a |! ?; z
}
/ z* w/ J0 M: C5 w
8 {8 i0 K# U% H9 p9 W0 L @keyframes animatezoom {
) ^. }* f. c' ]' V+ X/ l) h( T from {& C& F5 P2 R9 }9 F, s
transform: scale(0)
& M+ C- E9 i6 y: f }1 q F c7 V' i
* Z+ `$ D- ~. M( i' g. E6 ?6 X to {! k' O9 e6 Y$ F
transform: scale(1)
/ m2 M* W# h% [ D }5 s z: g w1 n; ^- e6 }5 w
}
7 z" C% \3 L! h: K1 V+ d3 e /* Change styles for span and cancel button on extra small screens */, S9 b/ l5 Y3 ~# h
@media screen and (max-width: 300px) {) E, S- n9 g7 Z& w
span.password {, P3 O* z9 c. H
display: block;/ J7 z6 Z. x3 x7 N9 @ Y3 Z6 M
float: none;; [8 ^/ f+ X' z6 s9 X5 Q
}
; N5 c( Z; H# K8 J
0 r+ {0 k4 E' C5 J4 r: s' _6 r. r .cancelbutton {
" [* I; W( e5 v) {. y I9 m width: 100%;
" H# @/ n6 @5 H- K Z; [5 L/ b }8 |6 B5 U1 v) q( I
}
2 w l8 Z- Y& R/ S/ | </style>
( _0 y, G- m" f</head>
- Y( o Z; {3 Y- {
& z. F- Q# o+ Y, J<body>
" d* a; A! f! F T+ P4 K# W5 I3 y% \7 ~5 M8 C
<button id="login">login</button>! \# r# ` E5 f8 ]; @% {
<button id="register">register</button>
4 J& k3 G- x; A. b3 g: G
2 x; B9 `3 ]6 p! H" L2 r <div id="formPanel" class="modal">8 [( b# |$ N8 E/ M
<form action="./img/logo.png" class="modal-content animate">
; ?/ I# F6 U* d- n. B <!-- image -->. ^8 ~% I. |" m' }1 o! u& d/ i
<div class="imgcontainer">6 H6 N% L g2 k$ g( j
<span id="closeButton" class="closeButton"
- t7 U0 f% C j' n5 C( K+ n
# }; E- Z+ l2 ^! G0 ? title="close form">×</span>
# B2 y( |5 B( O <img src="./img/img_avatar.png" alt="avatar" class="avtar">
2 K$ x5 Y/ F8 _/ C7 ?% G </div>$ N$ E# G* w# F" i
<!-- information --> W& S, t/ G" s0 L4 h9 d$ H3 _
<div class="container"> x% M8 k0 H9 H! W. Y2 Q2 D+ m) M! u
<label><b>UserName</b></label>3 x4 ~( u8 P! K5 {0 h( [: ^
<input type="text" placeholder="username" class="username" required>
1 R0 |# L2 Y/ g3 F4 O <label><b>Password</b></label>: \' o' o! w1 V% b S
<input type="password" placeholder="password" class="password" required>5 q }+ v! P1 [# Q
<button class="loginButton">Login</button>
; x8 l' Q) n# j6 ^- g) p <input type="checkbox" checked>Remember Me
5 y( f7 r& C( _$ z" q8 f( l </div>- ?, J0 ]8 a& R- Z, A8 l7 A
$ M6 r# h) q: c0 e; c
<div class="container">
" ^: n R7 h- S- L4 c1 w( x. i/ M <button class="cancelbutton" type="button"
0 N' |1 i3 c1 s( \, d >Cancel</button>) d" `) y+ k7 V+ q
<span class="password">Forgot& Q" j* u7 I# P. |
<a href="#">password?</a>" H: V$ A; L! l5 F2 K' m
</span>" c+ [' f$ p+ Q j# a# }; D
</div>* d5 B9 A* ?* Y$ J( }" ]
</form>
/ k" [- G- Z( C; p </div>
$ k7 k6 V8 w0 L8 o6 n3 M9 j3 V3 o. Y% A) a8 P5 K, Q. e+ y6 @
7 T! p+ [, ?5 R( a <script>! ?4 i9 k, K' Z
5 F* k! M1 z/ K ^ function loginForm() {
0 `3 D& Y8 l4 ]8 m2 P var formx = document.getElementById("formPanel")4 F$ f- v, L6 s2 ?' a6 ~8 E
formx.style.display = "block"$ T- M% U! N; b( t; h
}
& T0 {! x: V# _6 V! _6 t$ { </script>
2 q% ]; p! @2 m% z- I. w
: l7 a0 u# _% K: m/ a4 h3 R% v" h/ V
</body>
9 A) E$ y; m# E, s, A& u. g1 b" ^! P' U$ R' o) W
</html>[/mw_shl_code]& O: `4 T% R/ P( y/ Q
" G( O3 T: ~9 V# d( p m5 I3 F/ I
: f8 y& c7 w9 t
注册代码
+ m+ F5 H5 U7 E5 r4 D) Y
7 `+ J( V+ Z1 k6 ^6 i8 i; `[mw_shl_code=html,true]<html lang="en">
7 s' U) B1 Y% Q3 [
6 I( \) E! @& O# T* G, F<head>
7 Q: b% p. F: R% s" s <meta charset="UTF-8">1 n" A# H- {' `" w% z' b6 w
<meta name="viewport" content="width=device-width, initial-scale=1.0">) T3 \* ^9 R3 d% a6 ~9 P/ V
<meta http-equiv="X-UA-Compatible" content="ie=edge">
0 i/ R3 c5 ?( }% h; k <title>register form</title>
) V9 V1 R9 p# T: U( Y1 p% N6 U1 F1 A$ Z8 ]/ ?, m2 t0 m
<style>
3 I5 H+ F: K; E. k( U3 H' r .panel {( N2 x$ V6 B6 m1 f, p' L
width: 100%;
! u. q# m& F4 ~" `" h$ ^9 H( S height: 100%;
7 `& @4 ?( Q( R; z% L7 Y background-color: rgb(0, 0, 0, 0.2);
3 A- P. u. g1 i) L: P; D padding-top: 30px;
M% e$ O9 }& |2 f( ^( r9 [7 B: ` overflow: auto;' l( S6 r- n7 }; m; c" I! k) \
position: fixed;3 c4 I8 [) R8 _9 b% U' `/ M1 K
left: 0;3 _+ v& ^% [% }6 R' c. Z5 w
right: 0;
7 m% Z7 G5 G7 u; q' A z-index: 1;' y+ s+ U" c: i( f) ?
}9 n0 ? z# b1 R
6 G7 `! v+ g. d3 ~; a/ b .modal-content {
# l6 F5 P( y( p/ Y! j background: #fefefe;9 P/ V) [6 y/ r) L
width: 60%;
0 B& L' p8 k# y0 c% L* Q border: 1px solid #888;
. ]- D6 z; s; j( @2 a1 S8 G* k margin: 5% auto 25% auto;7 C! @% {7 h9 I2 M/ H+ s! p7 w, }
1 _' v7 _ c" x3 T/ c) q; D }
: l, I T2 g( j6 h0 S i7 V* X9 z# B9 H, U$ g& [4 b( a. X7 N* A
.container {
7 c3 ]3 N t' O/ ^' `/ r, N& M padding: 16px;- y, d6 b8 M! J! t4 l2 E
}
; z& g) y( t h
$ A7 _3 x. a8 S1 \) k .close {
A+ R0 T9 `3 H* m4 @5 P font-size: 40px;
$ c5 n: { I6 i8 p position: absolute;
7 W; [; U" k6 g, X: a$ _& b top: 15px;
R7 i& u+ U" ]- ~+ S right: 20px;
- v; l9 Y$ D+ p6 J1 x! M3 a% a }
. z& k4 Y: \. W6 z8 p: ~
8 x B; V5 B7 x- `" v; p! m .close:hover,
# D3 P" q6 q, m# A, ^ .close:focus {
# k6 Z( k, l; c# `4 _+ y1 ~" S9 | color: red;
# Z# O7 z- U8 m( k' F cursor: pointer;
" {) F, V0 G& t9 k }
2 d* o+ [6 F. s. g- n5 s- Q: X5 F; `: ~& d5 D6 E/ U
input[type=text],5 P+ C% l& A7 Y# p6 Y7 s: }# P
input[type=password] {
$ x( U$ J' H# J+ f width: 100%;9 K2 X3 L! ]5 B# k8 {/ I4 G4 I# _
padding: 12px 20px;, Q. U1 p; o) L$ h
margin: 8px auto;
0 D4 Z' G( b) k6 {8 f9 q border: 1px solid #cccccc;
( k2 H7 T1 C2 P display: inline-block;4 s. G5 `$ M' k1 P6 q
}* z6 ]: m* F5 q! D
" \" [1 }% V% X6 R: A
button {
% f: g3 d( M3 ]# |7 a& b5 f background-color: #4CAF50;0 `, I8 R2 I6 K0 X* H( v7 J& Q
color: white;
" n, J! q" K$ |3 k% v& R# H3 U5 j padding: 14px 20px;
4 g% p- ~6 q! L' ~$ U" L* p: B margin: 8px 0;$ h3 e5 F# F7 y( F' r
border: none;6 L: e1 [, a" r4 j, X* A1 J
cursor: pointer;8 @+ |2 j) n- q7 W& W, k+ o6 ?
width: 100%;
8 ]5 o& l6 P/ ?. P7 \# j }
) ^$ J- m. I' R, }0 x
2 ]" V- Q; {% r! f. V" l0 B .cancelbutton {
( e* u8 L* {7 Z' f( s1 O- F8 e padding: 14px 20px;
8 M. \- X- j7 @4 k& e. M8 e background-color: #f44336;
* ~3 c( \/ u8 F k }8 z+ }1 Y" `) W2 o& e: l9 L
. S, j+ I# C, f7 P) g) t
.cancelbutton,* {2 f# s' u( h- T: j& K! R- k
.registerbutton {: n% s6 B6 L- A' b0 A
float: left;
' J0 h# h5 s* y% { width: 50%
: n+ w& q$ l! K, t- ` }
- \" X3 u; h3 A" a- V: A. e+ Y& i4 M7 z/ P3 W
.clearfix::after {
4 w* T: A4 U+ L) b, b7 K% n content: "";
0 h3 ~& ~* w7 {* Z clear: both;$ R! G9 E5 ^6 j3 r) j1 ~( m! p8 F
display: table;
: q1 @. P) C) t9 y' T1 i+ ^+ y }
/ V4 [& @- J" R </style>
- D+ a, U5 ?+ s4 k
" \8 k8 S. ]! S: F. L- ]
8 A0 \" k9 L8 g, ?7 p9 o( E/ F
+ Q3 x8 i! d# [# Y# l</head>& F( W" N4 K! A6 D
* Q2 H! A1 d: U7 D5 `4 y2 b. B, [
<body>
# z* T2 j' c2 W/ ], L1 S. C, | {+ ]/ f4 b* q% d& Q
<div id="modal" class="panel">2 r$ I' f0 ~0 ]- O8 A2 i/ B2 k, {- Y4 u
<span class="close">x</span>8 v2 K! z; L8 U; n* k! ]
<form action="#" class="modal-content">$ G- m- z8 a6 I) P5 X
<div class="container">
7 h. k# {9 u2 D <label>Email</label>3 y% b( r' E( v6 N% `* ]2 T* j
<input type="text" placeholder="Emmail" required>0 S8 j$ D f9 Q
<label>Username</label>9 ]& f8 y) o$ b( {1 H; W2 B: h
<input type="text" placeholder="username" required>0 \: T6 ?. Z$ R3 T" h. n
<label>password</label>
% H T* s2 ]* x8 V+ ` <input type="password" placeholder="password" required>
* B6 \: A' b1 z8 b <input type="checkbox" checked> remember me
- ?+ b7 H" h1 Z& i# r <p>Follow the policy <a href="#">terms & privacy</a></p>) c& S- u! |, ], H( y, j+ A
7 K* V: g' O: v
2 ^" j; A- p1 O% m$ @6 { <div class="clearfix">
5 Z: E: I" i9 y" s8 i6 b; [+ x <button class="cancelbutton">Cancel</button>
2 i5 Y4 a, B+ L7 S5 X0 K <button class="registerbutton">Register</button>
6 [% U* A6 `9 ]. r </div>
( i. }8 ^6 f: ]! b6 y </div>
* b% [1 d( @1 j1 y$ Q- H( E </form>/ a! Y: a/ m: m( O" ^0 \
</div>: e1 i1 _% S: l# f. l$ O1 Q4 p/ M
* J8 b$ e8 h* @, v* Z- o- i, i9 J8 E3 \; R- K$ e
Y, A' z+ e3 q$ Y ?+ M
5 e- I3 ]9 I6 \" [0 I L9 l; U
0 B$ H4 \% U$ j: o2 W4 r</body>
1 [5 |' m5 c" V$ }9 |8 v2 w; P2 x5 [& n! C( p+ |! I- P5 b
</html>[/mw_shl_code]6 x) _ O1 ~4 }- v1 g& l
|
|