|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面3 B( v+ L9 Y1 J4 d+ t% u( z: ~3 I9 B
$ l) s5 b" Z$ S1 O% k9 B' N; F7 c0 [* Y
* V3 ]' }7 i" _& W
登录代码:
- x+ Y( S" Y) B8 J( D# @ @. _. g! P& d& p7 f- _( |
[mw_shl_code=html,true]<html lang="en">
3 n; P$ ~$ f! a D( L% j' C. k1 }8 N# L" a9 j1 Y
<head>$ w0 R3 Q. {* u& i3 C3 @
<meta charset="UTF-8">8 K# Y8 U) ?9 ^0 b
<meta name="viewport" content="width=device-width, initial-scale=1.0">0 ^. U: q/ G) E$ j) @+ V
<meta http-equiv="X-UA-Compatible" content="ie=edge">7 Y+ e; p% z. x8 c/ R% F6 j. M
<title>This is a login form</title>4 F9 [ k) H- v, e8 H
~# s$ e. B: i3 ^
<style>3 h' V$ [' p( h' d- h. b
.modal {
% B j2 U! k! ^2 o5 a6 n9 R display: none;
# I; ?2 c9 Y4 {4 D M width: 100%;" O5 B* n2 o l/ s4 O1 E" G
height: 100%;
2 D( m5 _7 d. V+ j) O position: fixed;
* F$ @& {8 \! X: _- h! I! n1 S overflow: auto;9 N; d$ A7 M) V9 a
z-index: 1;
1 e, j! P8 G% _% m: a left: 0;
C q0 W" o' [) P$ T% h8 s top: 0;
0 Y% m- l+ x0 R' q2 C4 ^, Z$ [ background-color: rgb(0, 0, 0);' \3 x; L! u* V7 z6 l- y( l" E
/* Fallback color */# Q* y( t# i4 v& F1 q! G, Y- s; x' Q
background-color: rgba(0, 0, 0, 0.4);+ l t0 _$ }+ o
/* Black w/ opacity */
- a+ r) z) _2 k l) C/ _ padding-top: 60px;, q G! i( W3 I7 h! @, j" R
# _ j8 k7 ]$ ]7 q$ |
}
5 J) Z2 n4 H& y5 _! i5 D2 h
8 I# _. ~4 |/ Y- @+ R3 ~8 \ .modal-content {8 m& Z6 O5 Z1 D+ J' g
width: 60%;
+ n: E T; N$ ?) }; W) h, H4 i& T background-color: #fefefe;
0 q: B6 N) J7 Y" _+ f margin: 5% auto 15% auto;7 u) t4 r3 K0 p# X; M, r, g) Q
border: 1px solid #888;$ V! k$ i7 D% \5 t1 R+ R0 ^3 r
: q$ g" m) H0 _9 p. X5 A3 F/ }
}( v1 V( L: b. n4 u
% x( [8 H$ s. y+ t
/* The Close Button (x) */
% N" |2 O6 P6 I8 O* y .closeButton {, u; X/ ~/ q5 N5 X5 c
position: absolute;
. ?' L1 O6 I# w( n5 U" y4 K right: 25px;' H2 H! @7 J f$ |/ G
top: 0;
% Q5 ~) n. ]/ s. ^* S- I color: #000;0 K5 h% H2 S) v7 G5 I7 Z
font-size: 35px;9 e z5 i! \2 u; s$ x& e/ I6 {" Y
font-weight: bold;5 D2 s. s" k6 p9 H% c' v
}
6 R9 y, g# f. c/ v7 J. o# A! t1 T3 {, r& v6 ^" D! v# d7 y R" h
.cancelbutton {
5 x' o$ a, ?) H width: auto;
" j+ K* `" m' N4 N7 B padding: 10px 18px;
% z' P% a8 V# L/ M& A, f% h0 @ background-color: #f44336;
8 d" l. z& t0 T% X }; I5 U5 q2 _2 @9 H
$ Z4 N) X! C9 y3 h0 l. m+ x
span.password {" U8 [' X, c) \% t4 a
float: right;2 {6 ?+ Q R3 f4 B
padding-top: 16px;
, T9 m0 q6 G0 i, p }
1 P4 M6 S& g/ Y9 k: N1 J( a. w. {8 z& @. Y( n0 M! |3 U" ?
.closeButton:hover,5 W0 {. ?9 A9 \4 w! S y1 E. C
.closeButton:focus {
% v4 O+ I' n+ [# \7 d color: firebrick;
5 `! Z# E" y y( V cursor: pointer;. T1 y' |( ^9 A" u) g
& E) U$ h( m7 X6 M* ^
}
' Q0 z8 f" o+ A$ U1 a# C! z2 D" r s% D O
.imgcontainer {
! z/ G) O2 v5 N( G/ T+ x! o text-align: center;; o- Q1 T* t! B o8 ^: K
margin: 24px 0 12px 0;! a8 x7 z* I( m1 q/ G6 a1 C
position: relative;) B- u. X% a( g. U% Q# Y
}+ d8 z- ?" b2 K2 P+ ~
' C& | `5 u+ Z4 P6 {8 L .avtar {
% B u5 T) u$ G. [, Q8 b/ C width: 40%;
$ Z" ]8 m% z( r5 a# I" y$ m5 P border-radius: 50%;8 R/ S$ V0 I( m& c! y
}0 A) V# l1 ?; F8 T% _8 z2 Y6 T) ?
% g- h! G8 L% u4 x4 i5 v* w, r
.container {- a7 l* L- _* v; q) N1 t/ a
padding: 16px;+ S. J8 P5 H; c, ^3 [0 o* h' m
} a2 Y3 N8 S* |7 c, B; E: n
1 P8 n/ n* m; S7 u /* Full-width input fields */* [$ \0 V) G8 Z* K$ G
input[type=text],
' G9 z/ \' c9 l! H: f5 w input[type=password] {
2 S& b' m# V8 A( _/ C5 j5 e( y width: 100%; x. } I! r8 B" u2 \7 t7 e- _
padding: 12px 20px;
8 v+ p8 I! e$ _' N2 D, ] margin: 8px 0;
; n: p' d7 f& W- {) N& K" L$ I display: inline-block;
$ A$ Q! [; f2 Q* Q& M border: 1px solid #ccc;+ X. v' U; p# @6 x+ f$ ^! s4 `% M
box-sizing: border-box;$ ?0 l8 C s2 q' w1 E' H& h2 p
}
9 O! W4 Q" ]3 ?; s+ S' M
: j* S5 x+ @. g- w0 \ /* Set a style for all buttons */
1 s& h: h: f5 E5 R2 t button {1 v. r- T2 q, n& J$ _" F
background-color: #4CAF50;% O# c2 ?* W5 N5 `; K P4 B! o
color: white;
: p# s' C o9 z# n8 i) ~6 R$ F padding: 14px 20px;7 n( L) @- d/ D6 V7 |3 `# @
margin: 8px 0;1 ]/ a* N# U0 F J9 J3 y$ Q
border: none;+ l+ W1 A5 j, w p% m. K
cursor: pointer;
" |+ R1 [% t) T: w6 y, ^6 D& \ width: 100%;0 j P% p, s# z! r
}
- x9 {6 o o, s) }9 B! C3 N) Z4 _8 Y0 q- D4 Q9 E# H' j0 t& E% R. R
3 Z3 Z4 x9 l: N; y button:hover {3 E" o: V. s( r! ^9 g L
opacity: 0.8;
+ _+ W; J O' W# Z# D$ n5 C/ C }
: U+ y' q, Y8 f( {* H& I$ K" d8 J! _3 X4 f
/* Add Zoom Animation */6 ?# W: ^0 U$ x( W3 {- W: F+ n& [
.animate {6 r0 h2 n# H- B5 n
-webkit-animation: animatezoom 0.6s;$ F% |' O x$ }" ]* @$ g' J0 f
animation: animatezoom 0.6s6 l" ^" w9 i e5 s* P
}, Z7 \4 s& u# e1 I4 N- j0 a6 G0 X
7 ]1 `2 A+ A2 k; ~! {9 g1 P) n
@-webkit-keyframes animatezoom {% I; ~7 d& E: s8 a2 B+ i# p
from {
8 x( v: |' \7 h3 ~0 [! I9 G! s -webkit-transform: scale(0)
2 _& f/ M+ `0 k d9 O+ l% o* E }
- `' o2 t, ]* D& X2 m; s5 F% {# v7 W$ ]7 Z1 y; x- C& N
to {
* u, C7 V' Z# n0 p! M0 w -webkit-transform: scale(1)
3 z/ r- f' X0 S9 H- a$ L+ k% Y% E } s% Y, [7 K& V; ^; ?: ]9 D7 D( f6 U% `
}3 ]/ n/ P# c1 p& L
* D c/ C7 V" j0 N6 A( s2 |7 n
@keyframes animatezoom {2 y4 s% [2 L, v2 k* ?. W
from {
* L! E! k/ W- c1 a( Z transform: scale(0)
; R) m$ i# n w- W }/ \8 b! b' M4 @% V8 R! |* g, {3 ]1 c
% s. M& H& F+ z# g9 p to {
* z t/ ?6 @; ~/ t+ R) f& C6 S" x transform: scale(1)
( {( `7 m1 `! ^ }9 ^) C: b% w/ N) V2 I" E
}. f& d0 B3 w' d4 j$ \
/* Change styles for span and cancel button on extra small screens */$ @3 g$ h7 r+ v* X" h2 L! q
@media screen and (max-width: 300px) {
0 S" V% z! G3 Q6 Z& I span.password {- a C) R$ I! C! D# @+ B( f( F
display: block;4 z- E. }$ J; u+ `
float: none;" y( d- Z1 z8 S' j' D" {- M
}
( p! o" N0 s2 u: ^# l* U! s
7 ~% u# g H# k) A2 N+ @ .cancelbutton {( z; `& D& ]( U- m5 b
width: 100%;. D5 l$ ~0 l+ `
}: X) O; s% C9 p3 e0 t8 L
}
/ {5 B. m2 W0 w9 V+ V0 n </style>2 G4 U0 u% n' o: g5 p# D D
</head>
7 k! Q2 ]' p1 @* T* S
: Y% \3 Y2 i! R7 u9 J+ T<body># M- G# V" E1 A& \) p
; A* i1 E8 C" M8 R( Z' F) I$ K
<button id="login">login</button>* W) G! v9 n" K) K
<button id="register">register</button>; g1 z/ ?$ X7 H
# @- s# i6 Z8 O3 g <div id="formPanel" class="modal">
0 p6 X* K8 w0 N% u! k <form action="./img/logo.png" class="modal-content animate">/ w9 [6 q f- }; c
<!-- image -->
; @) s" y; s& X [ <div class="imgcontainer">
5 t W# F5 F7 y; q: D, |4 j* U% \ <span id="closeButton" class="closeButton"
3 @% m0 U+ Y. d6 q) J6 A+ a+ C & H8 l) e5 V6 a2 z
title="close form">×</span>- |; P3 s. `$ u$ K& Q ~
<img src="./img/img_avatar.png" alt="avatar" class="avtar">+ [" U( u2 d" v) X/ c
</div>, |( X* r, r, S
<!-- information -->4 B( ]9 ]& r$ s8 k; _! V
<div class="container">
+ j3 R2 C4 F- b6 _2 [ <label><b>UserName</b></label>
L* Z4 E4 G9 t- v/ k# n2 i <input type="text" placeholder="username" class="username" required>' Y4 p! Y7 u4 s5 w9 F
<label><b>Password</b></label>
, A, P7 x) Y. o" E# m <input type="password" placeholder="password" class="password" required>- u! ~, Z) `$ A; @
<button class="loginButton">Login</button>
P* J# `. D i$ [: c. o1 b <input type="checkbox" checked>Remember Me
; L& I6 f: b7 }4 k: |' B </div> z- D5 d8 h: R# U* f
) c# |, O: x* e/ U' Z5 ? <div class="container">
& w! [3 ^5 S$ H* {1 c; |; s <button class="cancelbutton" type="button"
6 G, H+ x( A+ h1 V' k3 S >Cancel</button>
$ z! i) K/ I: j& L; j" {; b <span class="password">Forgot& @; h# B+ P8 D+ G
<a href="#">password?</a>+ T0 N# q# N3 Q) \. j i8 U
</span>
% S. C& N) ^* }9 ~1 E) ~ </div>
. x+ h! {1 z: a. V C, v </form>' z8 |1 j3 |5 g& {
</div>; O" i+ ?8 k% v% u( R5 o1 H
' Y) l8 x7 n/ ]: X0 C' k9 i# ?
0 d9 P6 J$ t! V4 U/ E5 w <script>% J) [4 N9 @$ h! r, C/ Z; y7 j
3 a# V3 m2 S( H: i' _1 Z0 r4 j9 A7 t: F
function loginForm() {
2 e% Z0 M6 d# y+ h& x var formx = document.getElementById("formPanel")
8 B7 F4 f3 c8 d& d& [2 D; ~ formx.style.display = "block"
" {2 l! ?; a4 E1 l$ W; N/ l }9 d: S5 }% b* F: z
</script>3 b% p: f9 }3 E3 \5 J; L5 _# T; s
6 {. U6 r% @4 t* y7 W
2 T/ r( q* {' m7 Y( y</body># G; `. L* r1 h( o# k( `
1 L# E7 l. j9 v9 V</html>[/mw_shl_code]
- H, e- i% N B8 q
4 b v, O1 S7 Y9 m) ?2 H5 B; p0 c% x: U2 B2 u! Y
注册代码
& R/ W- [: ]2 B5 U4 R5 M# T; S/ i) K' E
[mw_shl_code=html,true]<html lang="en">
5 A% A$ c6 T7 v1 y; ^6 D" {5 J& ^, B9 O% c$ g7 m% c( G: k* Z
<head>
0 J# Z! A- G. h, m0 D0 X0 Q <meta charset="UTF-8">
/ u7 P& s! k7 ?! \ <meta name="viewport" content="width=device-width, initial-scale=1.0">
/ ], d0 f, [. N3 Z" l <meta http-equiv="X-UA-Compatible" content="ie=edge">
# `( k3 S' Y/ I, `5 z! L1 P, T <title>register form</title>
4 N/ \" j2 |/ m; }- g8 s. U0 e& L) |! \: C- e8 \
<style>* @! w" i( g) a/ k. d: u* ^( a
.panel {7 w/ p- q) T4 ?% _8 ?- v5 d$ D" N
width: 100%;
! k9 A i5 o- y2 D: R2 l. J height: 100%;
0 c! A* U9 d4 Y9 ~ background-color: rgb(0, 0, 0, 0.2);5 q: k* q. N6 \
padding-top: 30px;
1 H+ h; v9 Y/ d0 u9 X overflow: auto;
$ h5 k- X& |( r! a' f4 U0 V% t position: fixed;
! b8 f9 e& X. y! T0 ?! f l$ a$ f left: 0;; L2 {( x1 Z+ U3 c: f
right: 0;
; s* l8 _8 V! j+ j- t z-index: 1;. @$ ^! d' v/ N
}8 p5 Q# s5 d' D4 _& A7 T( b7 k
5 y6 B* e3 X) ` .modal-content {0 o2 i+ r1 g" |/ f$ i/ h
background: #fefefe;7 U7 [3 E: p' K/ j9 B- M( f
width: 60%;
& P* J2 V& D& h i border: 1px solid #888;$ k2 C: M4 u: ]" J
margin: 5% auto 25% auto;
0 T t, p- \. m/ X$ i0 u) f. v( r% e7 J/ E# N! _6 `; G6 i
}- _/ G8 Z2 v, g) P0 o
6 E# u7 A0 K3 I8 |1 z: R .container {
7 M# v1 d3 a- n6 Z) |0 r padding: 16px;
% z1 C+ T5 v5 G% T3 |1 ?5 l }
2 D. Z* j v4 g, o1 k1 n$ I2 d$ v* p2 v3 V" e* F9 b. y
.close {3 ^" \4 W2 _: b+ M+ z4 t) S5 p1 {7 ?
font-size: 40px;# E, ~: k: R; W
position: absolute;
, t! \0 ?( g7 b top: 15px;. e) [ z& e5 s
right: 20px;
' D1 R# H5 t5 q/ n7 T/ R' K }
% W! Q( |, z/ x0 x* S# w& Y: z, ]- z) y( t7 P
.close:hover,( W. e9 I# f5 y' f) k8 S
.close:focus {
7 C0 x* J, V) ?7 ?2 s color: red;4 d7 @2 v) c, f8 c& N6 w8 ^
cursor: pointer;
* ]( O# n/ o2 O }
% ?! I/ z6 g6 J& w' q- A' n6 u4 o6 X5 Q/ m1 U& ?
input[type=text],
' L% P) G: ^2 b3 D9 [. ^2 q6 s input[type=password] {
$ A" ]; z" `; O' _3 e) y) c3 L8 t width: 100%;. l8 I( p: [! Z. l/ F
padding: 12px 20px;
N/ ]4 h( ~ y/ |1 m8 M% t/ u margin: 8px auto;
3 z! Q. h, l* A2 ^3 A border: 1px solid #cccccc;. _, n- \: h6 g# f! _. K$ ?6 M
display: inline-block;
3 J* g4 s& R2 | }
z) t# W. i4 i+ o4 d7 k
$ B, v, f/ z7 U& F* ^2 S button {
e9 d, N, f7 s- E! a background-color: #4CAF50;
5 W% S% M+ G k, E# ~+ i color: white;
" E. d, r1 ` ^. r4 O! a padding: 14px 20px;+ }, s* l X- {" f. S3 }
margin: 8px 0;: d) d+ l+ Z# W' z5 ^, K9 Z3 n7 M
border: none;8 V' c; h/ X( n& \. J% z
cursor: pointer;
( ^( o8 i* b* B4 x0 x1 X6 h width: 100%;$ w, V: r: X9 ~4 E
}
+ C2 O+ z' p) e/ X, q
& G3 h, H: t& F3 L- T .cancelbutton {8 V! U3 X% _. `0 j& b5 V( X
padding: 14px 20px;
" e' x2 b C; \' ` background-color: #f44336;' q' n+ H& G6 P$ `
}
- K4 Y" Z& V6 _8 g- p* m' N! Q$ J6 ?: S% G2 W
.cancelbutton,
" D+ M0 K% `/ e1 m6 A .registerbutton {
7 R1 Z/ L0 J# i* e' o2 R0 d$ Y float: left;
1 L6 `. S1 i9 ?* c( ]9 C width: 50%
3 X" f5 T; R8 H# n7 ]# U }
$ e+ V4 }: S0 X' }9 V2 `7 c9 H7 x2 y" f9 K- G6 E# L- Z
.clearfix::after {( Q3 Q4 a a' K" _- `+ Q y& i3 N" o
content: "";
# B, s1 E5 X0 N2 w+ |. }7 \" G clear: both;3 A6 H9 L7 w" F9 J$ }. p/ T! V
display: table;. q0 i" B: |* a: ~' b7 y
}
. K; [2 R. v5 f8 ?: ] </style>* m+ ]3 r# n0 X$ [- G
! d) V Y3 O3 z
8 X7 c4 d8 L4 n& h& k6 A/ B& B% z. a" n
</head>3 x3 e# I6 q7 C8 g( g- V
+ `! j( `$ ?; G<body>/ g! g3 p3 _. i' |$ N" q
% k1 e& z+ l k% X3 l! }
<div id="modal" class="panel">
/ v( _+ `- f: ]4 l9 O <span class="close">x</span>2 X: q# L G- m7 z; |. f/ ?6 |( N
<form action="#" class="modal-content">. n/ a: L7 O& y# r. @8 Z e
<div class="container">7 ]1 Y7 i: A# i! K3 y% b1 b7 l# Z
<label>Email</label>
4 W+ L3 [* e' ?* m5 u <input type="text" placeholder="Emmail" required>
& @4 U! C, z- q& t <label>Username</label>
. z' W( [' H b$ I% \) s$ w) U <input type="text" placeholder="username" required>, u, s" i' K! v* H0 ]: F
<label>password</label>
& N% V% Y* i& I; j <input type="password" placeholder="password" required>- w/ U. F% W k
<input type="checkbox" checked> remember me
" ~+ @* z" S: U5 q% U8 d <p>Follow the policy <a href="#">terms & privacy</a></p>
) m0 ]! o& S( t& a1 s4 \8 N# {. o' q3 z: C& U2 ?
9 N$ U+ n2 _ U <div class="clearfix">
- \+ {8 d* Y) k i7 B- f0 B* x6 [* p <button class="cancelbutton">Cancel</button>
8 z% [) g: m' } l. | <button class="registerbutton">Register</button>4 E; H- }, W' s! R
</div>
+ w1 [) c8 m9 A4 N6 b7 D& e </div>
E/ A' ]* ~$ A3 X* [+ X </form>
3 i( u) X' w8 F. _ </div>9 p/ g# M+ \- q s' P( D$ g
; Q( g/ s. z" p0 ?8 Y0 R9 a, H
! A( i' S0 Z# [$ j' ]& N- Q+ y0 V. b1 w5 V) D6 U+ u
! ?& b! K4 ?5 } _6 `' g7 _" |2 I1 \& E0 ?; D; c3 a+ w6 C
</body>% b( F; o2 }$ ]% O }7 b9 Y1 y/ S
" o2 l; ~8 c9 l$ J
</html>[/mw_shl_code]5 D; Y2 }8 t$ p* ?$ B+ }
|
|