|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
/ i5 r" A9 {! T# q3 I* a- B* A8 a; H; D
# @$ _7 j4 F. g) l% m6 Y登录代码:
0 T/ B; S" X7 I6 K# c, T& T5 X$ I! k
[mw_shl_code=html,true]<html lang="en">
, q7 x/ E% ?3 ]0 N' U2 A* c5 U6 ?0 I) R
<head>
/ v7 g+ v' b2 l <meta charset="UTF-8">
/ u/ V2 j4 E; O) R3 m# n7 B7 c( a <meta name="viewport" content="width=device-width, initial-scale=1.0">4 v* }& `/ R* z6 u6 u0 Q
<meta http-equiv="X-UA-Compatible" content="ie=edge">- O5 f7 r; i' i
<title>This is a login form</title>
) G/ x5 A2 c1 {9 q1 M+ B
6 _* h" t8 [/ r! P# q: f& [ <style>! ]1 ]6 [1 J: p& C+ Y9 R; B
.modal {
: ~/ b v4 B# f* {1 O7 b- O' a display: none;& j$ k2 ^. W" [" T; F" [
width: 100%;
, [1 x" H6 h8 ~2 h# T% \ height: 100%;
1 @9 k' P) J7 A' [ position: fixed;1 r9 W& L" ^# W; O6 |; k) V3 ]
overflow: auto;+ I3 a# ?5 f1 Y
z-index: 1;4 A5 v% s6 L! a! k' I
left: 0;
) I4 E$ H$ J; v top: 0;; s4 w4 z' e# v
background-color: rgb(0, 0, 0);- D) |2 e9 t0 H
/* Fallback color */
2 X# D- z% ?; o U9 j8 a E background-color: rgba(0, 0, 0, 0.4);1 l$ O0 s; }8 C3 \* c! }
/* Black w/ opacity */+ y) D6 Z* b6 O
padding-top: 60px; [ W/ u2 [6 S6 j: V
2 H6 D; ]/ D4 A! z7 E s+ ?
}, `- E+ c1 O: B$ g8 T
# s, g7 h6 f% |6 L .modal-content {
) h+ Q P" X' P+ M& n) H+ k: \ width: 60%;! j" V4 i" B+ _' w% q6 G
background-color: #fefefe;
- t4 B# L: ?5 O: C' Z4 a margin: 5% auto 15% auto;9 }) C$ q! M2 ]# B9 ^/ ?
border: 1px solid #888;
! @0 |: v2 Z. D0 `8 j/ n; H1 Y8 Q% N4 F8 M3 H" i7 C8 q; Q
}
+ D1 b& ?9 Q& j, P$ v) I5 D6 h m2 K6 L2 j8 g
/* The Close Button (x) */
4 M1 K4 S0 D. M% u; l .closeButton {# e0 e% c+ k/ u
position: absolute;
% c* {( ^! D# j7 V& L2 r& b1 i right: 25px;
/ `/ r( G2 K+ v' U: F2 [2 S. t top: 0;5 N9 C. F; O2 I; }7 |
color: #000;/ ]* F; l; L* R5 O& X; c
font-size: 35px;7 w j& r* \, |; _
font-weight: bold;
+ ]' l/ m6 B8 } }$ Y: s7 } _% i3 P) H4 W
8 W; L9 u3 N2 m: M' n4 \* v
.cancelbutton {; \: ]+ O6 r1 Z' x2 C
width: auto;
5 c( b3 _; @2 S1 }* G' C! z K padding: 10px 18px;
" S. A" `8 Y, w background-color: #f44336;
' L) ^1 }; E! \/ a, [ }0 `7 O; Z+ m5 R; W5 g) e' a
, d; H' \- Z4 k- i u5 B
span.password {8 S3 {- Z8 A; T5 o$ x- a! o
float: right;2 }+ S8 w' y- j7 p9 Q. z k
padding-top: 16px;
; r2 E: v: O0 _7 o0 W4 X& l( T }
' z* o1 u/ o2 X$ \- [# E& w1 Q; l6 E0 X# G4 C( X! V1 b
.closeButton:hover,
0 I% D1 P2 `% e; A/ f .closeButton:focus {
8 Y4 _3 c/ {1 @ color: firebrick;
( c, g p$ d! v: i8 s3 C: e cursor: pointer;5 U5 j m/ Q* ~, ]
9 H) Q6 J2 @4 b" s) W: q
}4 \$ {2 w+ }- x
( {4 H- b' U6 A/ j
.imgcontainer {5 t1 k3 j5 M" R6 w! A% g. }4 `
text-align: center;+ |( `2 u* D+ Y
margin: 24px 0 12px 0;+ m% N2 P) j8 U6 [; V+ t/ i3 ~' x
position: relative;7 C0 }, G- f. H$ l9 x+ G# q2 I% S
}& A! J1 B, I8 K4 m8 n
3 w) _: X: N7 l8 F
.avtar { F( ^. B# v- h
width: 40%;
& n* _" E. a. Z5 ]* {2 p. g border-radius: 50%;
: j( z4 b( H! {' W }
- d( D( n7 D6 I8 o7 K$ h; q; f/ s* p" X* J4 `, {
.container {
" s0 j# p, a; J1 i* I! ~ padding: 16px;
3 v2 O$ b8 Q2 b) a5 t% U" U, J! Y }1 d' X. c; _3 [5 A
0 `! T- W. e" B4 o% z2 h3 }' v /* Full-width input fields */
/ S8 M; _4 {+ J; ?, j input[type=text],
4 N6 x8 C- [& U5 r I5 G8 j input[type=password] {
6 f- H% b( K5 `+ f' o' b5 } width: 100%;
. I' j6 z8 C/ Q# _ padding: 12px 20px;2 p+ U! Y `# t% E1 h# i& `0 E# X4 @
margin: 8px 0;
7 s+ S* Y. P: i9 M/ Y' S1 A+ D! U; d display: inline-block;
0 ?/ L$ A3 P: U+ Y& D border: 1px solid #ccc;, E9 s& v2 l: H1 I8 W
box-sizing: border-box;% F' m. N. Q) V! v' b
}* b. G0 L1 F5 @( i( ~
0 z* {' ~. E0 X# |/ K8 ^1 ^ /* Set a style for all buttons */1 Q; }9 j7 B9 p1 ~5 t8 ]" G& Z
button {$ p9 h& k1 |6 N* N" I1 E# l
background-color: #4CAF50;0 `7 o7 |& h4 m' z* z' c% V. q
color: white;
0 q2 L5 D# A# t( D" X2 m$ P padding: 14px 20px;; f) P z/ p! O! I r7 \ q
margin: 8px 0;
9 Q9 o' P. N: j2 W6 D, p border: none;7 C! a5 }, _, r% b% L @) U
cursor: pointer;
3 V2 {% T& X" K# ^ width: 100%;8 H4 o3 u) O* U- I& D7 Q
}
) l+ w S* N4 P, S! q |9 V( L; n/ f/ U
. T8 A2 R; T3 Q! `
button:hover {
' f& {( v$ @, O7 ~7 R, | opacity: 0.8;
% l, Z7 l( C1 r3 L" P# h" B9 l% e }$ D. N/ c1 B: o* D
! X9 O6 B4 W1 }; Z3 ^$ Y4 O
/* Add Zoom Animation *// X+ r$ x& S4 _3 p- D8 o7 T
.animate {3 {6 v# D6 o' ~) q' d7 l% X2 R
-webkit-animation: animatezoom 0.6s; l$ H3 C# ?6 @$ G
animation: animatezoom 0.6s
- X" d* n) o3 u% G/ P7 F& c }
$ k! p) y3 @& H% B( W8 O; a! N; h! \! n% }) s. c* _% S
@-webkit-keyframes animatezoom {
& [& y" x- z" j; Z" c9 T; U- e from {
' Q/ z& r' V3 A$ i, e, t -webkit-transform: scale(0)5 i& V6 Q: m, ?: Y \0 |" g
}
7 y |) G" [6 B
4 J5 M+ ?/ l# p) ~3 k, y to {) X& S; |1 M* w
-webkit-transform: scale(1)
4 A9 l& G; A, {% ~" _ }) g* N* p4 t0 a; C6 w/ b. |' C8 m
}: ? ~" y: l" \9 u0 ]8 k
( C: C, Q- V. k8 R: O+ e$ G @keyframes animatezoom {* ?' M) f, @+ n5 w
from {
9 I) S# f& S6 ~8 l' l8 p transform: scale(0)
9 U1 R9 M% C* ~1 N7 W* k" C }
: R2 A- N/ i* O# P9 Q
3 d( ^0 L' n( _6 X3 }: W! F to {# n P4 l3 b) V" h/ G; s
transform: scale(1)# `* k [; V# l% x
}2 g4 a- b( r5 E3 d$ x1 J3 n/ U" I+ ]+ s
}. Y( @& S5 N3 w. t C( {* r$ S
/* Change styles for span and cancel button on extra small screens */8 {4 c; v# ]: @. V E
@media screen and (max-width: 300px) {+ y; J8 Z$ P' l
span.password {
4 d! ~8 }: r, M+ H5 Z# s display: block;( [ x( t1 V) k( c# W
float: none;- C! c2 O7 n; h/ ?
}5 {* L, U% i; _
0 l, T: l1 S$ V- d- R .cancelbutton {' M# v6 j( X% }. l& R) a8 K
width: 100%;7 M0 N3 x4 X8 E X
}
1 ~& W. K8 |: r; ]3 @ }' v! B2 g" p1 I
</style>
* _: e% K2 o6 } K</head>
5 p; r* J4 Z) k$ v5 d$ e# E" r" d+ P& X; O; Z/ O0 v& W: D. ^6 z
<body>5 ]* y+ U( _. I
: M+ ]: i R" `" O3 D <button id="login">login</button>: g+ ]1 ^" w: ]
<button id="register">register</button>2 i) u, |+ n2 O* \% ?' V
, |. s$ O, P8 [5 q7 ^
<div id="formPanel" class="modal">$ ^6 `! N' G; s9 a) V7 ~
<form action="./img/logo.png" class="modal-content animate">
: I0 ^2 N; q4 T0 { <!-- image -->5 C6 c# y$ g4 E% k: U3 D l
<div class="imgcontainer">
- Q2 k" X9 I& e! m8 v/ O1 w, ~ <span id="closeButton" class="closeButton"
9 g9 v; k$ _2 v" t ; `* i+ v( P& Z: A
title="close form">×</span>
- K2 A) o# s( J; j4 g, p <img src="./img/img_avatar.png" alt="avatar" class="avtar">
$ u2 J5 A& {3 c5 f </div>+ t' ]) R t2 }0 ^3 Y
<!-- information -->, o; b X+ M( u5 ]9 q9 ]
<div class="container">
& k4 w4 i! P% h8 Q3 T <label><b>UserName</b></label>
9 v$ U$ D, m5 A' w8 E <input type="text" placeholder="username" class="username" required>( @# \9 L8 a" P1 y' k" W, z7 M8 v" z \
<label><b>Password</b></label>' Z* x+ U4 ]/ ]; R# C
<input type="password" placeholder="password" class="password" required>' v. p8 s; _) j1 e K( U: Q, J3 K6 x
<button class="loginButton">Login</button>- ?0 w# `$ v: ?5 K/ X: l
<input type="checkbox" checked>Remember Me
4 r3 D7 E# }1 i0 v. _- b </div>
+ R. X- w1 q( `6 Q+ o0 W! j1 Z9 O& Y, [7 i0 t
<div class="container">& W0 A$ z; h5 a: k' h; k
<button class="cancelbutton" type="button"( X: k9 `' @& @4 e
>Cancel</button>, N$ k( M, {7 M- {
<span class="password">Forgot: h8 I( A, B J" `% A6 x
<a href="#">password?</a>' E# x' Z# F6 S
</span>
- \1 q) ~, w) b- z1 J% h( k) z* { </div>2 o5 h8 I9 V4 u; z# c
</form>
+ k' p5 l4 W+ j </div>
1 S1 @1 n+ d4 Y# S! o7 O: n! b9 J$ S# G9 Q4 ~
1 m& _" W0 u4 r( w5 p4 Z* l, j, {
<script>4 W, ?7 G, j, I# i! K& K* ?2 K
* f8 ?; ` U4 w8 C# p& y
function loginForm() {
1 ^* }& K4 M% h3 t p' y, ] var formx = document.getElementById("formPanel")2 A( U" z Y3 }6 P! O3 ^
formx.style.display = "block"
* s, }" q1 i, R# g6 } } ?" H' q: o! H9 b& R" t! J
</script>
" u. G% w' q3 J. Q, H% E% ]
0 X$ b4 F$ j2 r' p2 ^
3 R& c# H5 C! O</body>3 t+ h' l- V5 { k
) ]+ N+ t1 F( M
</html>[/mw_shl_code]- X* A' m! B! d) r* m+ M
& N* c2 {4 o6 Q$ T. |, P. U6 X5 u
+ d) ]# N9 T) L; D% [) B' O注册代码
4 [7 S D+ S! u( T
Z. f9 j1 V0 S; k$ ][mw_shl_code=html,true]<html lang="en">& T+ f" G3 d5 I: F
1 o4 J% w6 j" V: M
<head>6 Z" k8 A$ _, l2 [! v
<meta charset="UTF-8">$ l7 t& l! Y5 f+ _+ C B i2 x
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ e& r1 D9 s3 b; ^8 V% \0 d <meta http-equiv="X-UA-Compatible" content="ie=edge">4 c4 N. u) p3 D$ V/ o
<title>register form</title>, K. t% w4 x u5 T' ~
! G" m% A: z% X3 X$ j( o g
<style>
# _" e$ \% p% k7 P .panel {. j( \/ b$ g4 S" O% \" S
width: 100%;$ H- t' \' P+ T+ A; `% g
height: 100%;
* u- H$ m7 Z) I$ g X. o$ @% \ background-color: rgb(0, 0, 0, 0.2);% V% k+ L5 |* t1 b; c3 W( x; M, y. [" O
padding-top: 30px;
7 J) V+ M$ M' r; A* e/ b' I overflow: auto;
" @$ Y) M) S; X3 P- l3 ^ position: fixed;
' z3 t$ l: A" a \1 s; m left: 0;( r( |3 b5 q9 g# ^* k
right: 0;
E; b* |' E% } z-index: 1;
. v6 T- |: S! e% p3 c }$ D" m/ Y# p$ R3 X9 O) h
6 q2 T* s0 ~7 ^: q6 {! Y .modal-content {& W' W" w% T* ~. z3 I* B# S
background: #fefefe;
! S( r3 C/ X9 Y; I* W# m! ` width: 60%;3 V3 c$ H( I+ e+ r+ i# |
border: 1px solid #888;! S% x" ^, T, }
margin: 5% auto 25% auto;
8 Y& r. y' v# S
: G- |$ ^- o8 I) k7 N }- _) p J, u7 Y* y+ p% h0 B$ V
& r# I6 P* C" s
.container {- d5 {/ T! a% g: u+ f0 _5 b
padding: 16px;( s2 {- y y# l/ h$ `
}2 c! _) U7 H6 r5 t: @0 O* \
4 ]' x0 H# v5 f4 N6 x .close {7 k3 W3 g+ D4 s+ D }5 u" m3 t
font-size: 40px;! h d2 q# p( ?
position: absolute;4 g+ X+ L. U0 ]" v" n2 B c! @& Z
top: 15px;$ t2 @" w+ k: j
right: 20px;
" g6 ~. m! ?6 d7 P$ j- C7 K% R }# h. G. o7 L4 Z2 j3 S
8 a" b# h/ {6 Z1 O .close:hover,
x8 D6 z* P" }6 W, Q7 @ .close:focus {7 h( \; d6 D! w! ?6 P! b1 `# Q
color: red;! w1 j' }4 e. H9 M! x8 X
cursor: pointer;
) D O5 {4 i+ L0 X; n- g }
; a; C! M; Q- B, L* r9 w' P' h/ L$ W. H: q5 Z* ], j
input[type=text],
( h, A, O8 L1 t) m- B- H4 Y input[type=password] {
) Q% ]: ^- I0 S4 r" O$ Z width: 100%;
3 s H8 w6 J! ~. T: \ padding: 12px 20px;% c, \( n' Y7 G8 D# w% E8 F3 I2 b
margin: 8px auto;
% ]/ B: a5 g: _! t border: 1px solid #cccccc;
0 i. w/ _, E F* {( X display: inline-block;
6 b6 \: j9 w6 X: i0 } }
/ H4 s$ x& r' k7 F9 e! Y- a- W; ?) D3 N( m9 x! y9 N
button {
7 i: A3 x( k- d$ Q1 b. d; k5 _& b3 g background-color: #4CAF50;# Z) B) z( Q8 C0 x! m
color: white;. M8 W9 ^2 C" M% q( `
padding: 14px 20px;
6 l/ L3 ^8 O& U- @ \6 |* s# k | margin: 8px 0;3 F& d9 v# u6 l5 N! U" A
border: none;. J3 [, u5 A( `% E; U
cursor: pointer;
% |% }: N7 R6 p7 l4 Z width: 100%;9 d0 |. Z, ?! m: A* i. P2 }
}, f- @! A+ R0 ?$ |* f( `
( s q. O% L8 y8 G p
.cancelbutton {( d2 `8 d/ t- h
padding: 14px 20px;
: \/ S9 C3 B, W$ ~ background-color: #f44336;
3 B( r( p! C/ }9 d R; s) g) o1 K( H }
% }, p' S8 d8 `6 e5 j
7 q5 u2 V4 x$ o `9 S& d" e .cancelbutton,4 D* ^% a/ D8 ^$ B6 `7 w
.registerbutton {
/ V& r1 D8 v, i+ }) c float: left;
Y5 q( E. b2 X( K; {* X4 K width: 50%
1 C2 J% ^3 ?. s6 _" Q4 O2 _7 N: @ }
8 e2 J7 f2 r" X& O2 B5 j. k8 _! {8 s. ?7 `, a
.clearfix::after {5 G( t, j& V8 D1 ^
content: "";
/ Q) W- z+ q, [' Z' b clear: both;
) n/ p! X6 r3 s% r! F, k display: table;+ Y1 x9 h+ a S4 A9 e
}+ g& p, ]' U ]% Y" }: `
</style>
& J# F% _* g1 q; i" r! i# [
4 v6 a8 q$ V/ k9 w8 j: `
% g$ S7 N5 ?) w$ C! V7 b& r5 w4 m; ]# U- ]2 c8 b
</head>+ j0 s3 _' X$ v" J
9 M0 a& Y* b7 l* `) a1 K
<body>/ ]+ b( S2 {7 d/ \! E
* W1 K& Y* B! v1 Z
<div id="modal" class="panel">
8 \" n0 t3 q( W. y <span class="close">x</span>
; [5 H5 F5 f# L7 [" i <form action="#" class="modal-content">
- `) J- d0 l& C$ @6 R) K" e1 k2 T <div class="container">: B6 h, ]) q" {( g' c9 Q
<label>Email</label>/ B- d9 u- Y9 b$ C
<input type="text" placeholder="Emmail" required>( c5 f" Y' _4 B, J! h
<label>Username</label>. o- w0 `8 s& D* K0 M
<input type="text" placeholder="username" required>
% k. e; W! G' s( D" ]) E/ K <label>password</label>0 P8 q7 V: ~9 `
<input type="password" placeholder="password" required>
' F# l! |6 t8 l4 O; v( w <input type="checkbox" checked> remember me( M1 R5 \0 e6 |2 L, W p
<p>Follow the policy <a href="#">terms & privacy</a></p>
1 O U* T$ x5 j3 ]2 J% j
$ ]! ~) f, g" M
. V L% G& Y) b I" J( `4 l <div class="clearfix">* F( G! u; X6 V, h
<button class="cancelbutton">Cancel</button>/ t3 i k9 L$ q- m
<button class="registerbutton">Register</button>
, ?. F. H( b) `+ ~# [9 q; c </div>
( S4 M6 r! V9 M: U </div>
" `- M* e" B J$ O: z: r& l </form>- G3 `% w- ]8 ?/ @" q5 `- E
</div>7 a- }! w. {/ \4 ^3 Q. j
1 } G/ b0 [- e* T5 e0 b, H/ d2 E% r
8 A% ]* F5 V7 t4 `! a s5 ^ ~
) g. H ~" z: @& g" @
2 i$ ?4 w! a# u B+ q7 o1 K9 e+ ^ @# K8 G
</body>
7 f, Y: H" t; |' V% c6 S
* ^) J4 R5 R' e9 C3 d</html>[/mw_shl_code]
& E1 B: a; L% E7 F$ g: Y* f |
|