|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
+ {- P2 ?' t4 o/ z6 {. P) c8 z- E; k" s
2 r. q' f$ @1 F2 p l" m# Z登录代码:. w* W6 m2 t) ]) G4 [! P2 D
- v7 i2 m# Y0 ^- G1 ~[mw_shl_code=html,true]<html lang="en">' J- H8 @$ Q+ v5 q6 b; g
9 h' v+ A1 I0 a8 `" z# O<head>& s& |2 I0 T6 w
<meta charset="UTF-8">& _; w! H- b. `' ~$ s! U$ Y+ D
<meta name="viewport" content="width=device-width, initial-scale=1.0">4 b1 s- ^/ c+ V& i: o9 X1 {! D0 ^
<meta http-equiv="X-UA-Compatible" content="ie=edge">9 ?0 q: j5 N& d; u
<title>This is a login form</title>
6 b1 E% ~& k. y3 }
( E$ S/ Q, z6 X2 X <style>* F5 K! r! ~9 N2 ?5 p
.modal {
$ T9 W$ l9 R% K6 M) T4 m display: none;1 b- w$ W9 i( c
width: 100%;
B' a# I6 B! e height: 100%;+ T6 n/ x% p& d- [( X0 Z
position: fixed;
% S9 \& i0 K% {% ^2 Q overflow: auto;2 P1 `5 H {+ h2 ~
z-index: 1;. A7 w/ I# |" ~
left: 0;$ g' r% N" @2 x! [& w! n
top: 0;
# t9 ^/ I) y4 G7 J background-color: rgb(0, 0, 0);
6 \5 K- C7 A1 U. A1 ^: n! H ?9 @ /* Fallback color */$ m. j4 |( o+ Y% R" P7 i
background-color: rgba(0, 0, 0, 0.4);1 \0 l0 W+ t: N8 E& H+ o0 A
/* Black w/ opacity */
8 D4 q' J l2 U0 O; Q padding-top: 60px;
0 h: y5 V0 p, q4 n$ r3 t+ _- s' P3 B4 p. D& R" X
}& G# Z0 I0 v9 O) D1 }$ e
6 i. I/ q r* W .modal-content {: s+ K1 \+ P. o2 ~
width: 60%;* f, k7 \- ^7 F7 J
background-color: #fefefe;/ A) o \0 t6 Q$ u- b( `
margin: 5% auto 15% auto;
7 M2 z1 q& l' G border: 1px solid #888;
5 ]0 X" I0 q- P% i. u
1 u" m7 ]6 l) C% y. ]3 d4 N% j% I' h* c }
3 O3 S2 R8 b2 N* `% s
- u3 I0 O0 Y1 E /* The Close Button (x) */0 c( B" u# i1 d
.closeButton { i- J8 b" Y4 U# }8 z0 z# R" d
position: absolute;
g' ]. [) K j right: 25px;9 i4 _4 ~" E( t5 A# \+ ?
top: 0;
5 H5 Y4 T% k- F0 I4 C$ U color: #000;9 Z1 U2 g8 f0 l! \; t& Q' ]- k
font-size: 35px;
3 X" R9 V9 W1 S2 ?4 s1 z1 Q font-weight: bold;
, [# V$ ]4 j/ j+ v9 s; I }
' K6 j9 w+ [1 n q" r; l5 ~; O7 o5 A8 Y0 y- u
.cancelbutton {9 Y# z% Q. U1 @2 ?0 X
width: auto;3 u3 b4 H- Q' r$ _ W! P3 z
padding: 10px 18px;
X0 E4 @8 \+ e( }+ h1 I background-color: #f44336;8 A# H3 d, P# p7 A
}+ J' G" z- w" e1 k* q2 ?6 c, ^
2 x/ ]0 M3 I$ p span.password {
+ A7 W6 z7 `" g float: right;# S+ o0 ]& F$ L( H! J7 m
padding-top: 16px;
0 y6 f$ z% y8 R8 K }
9 a" ]# ~" O5 ~) L- t! q9 T+ C- C( [6 B0 K" t; H( L1 n- J! Q. z
.closeButton:hover,
8 N4 t( c6 v+ m, {( J .closeButton:focus {
) y; t' _7 J) e color: firebrick;
- K+ x3 t% Q4 x$ s% d0 F7 C; b cursor: pointer;) u9 U- y8 M {! a8 s
* m+ p% F$ _& ]- M' V9 E- z+ c }
- v4 ?- b5 I% w5 { ~/ T: H7 ?. \
+ X# o g x: z" f6 j. ~7 N .imgcontainer {
% P- v2 s7 r8 F: m' s, P text-align: center;4 n7 ^+ V- F* {' Y- Y0 S! h
margin: 24px 0 12px 0;/ Z& i1 E' p( q' A$ s
position: relative;$ O2 L/ y8 y, y! y% @( [4 _( s
}
% {4 X" B9 H" [ l' i1 L
- E+ n! `; \! d) O .avtar {
0 Y& ^; ^: ~, k1 A0 z width: 40%;
) J6 q% x2 m9 j8 F! T0 O6 n8 _ border-radius: 50%;
2 g2 H# C$ l+ P }6 |% f0 m: i% j$ s8 k3 d: R# Y
8 N# ~5 x- a9 i9 `; C
.container { @+ p! L; H; W: J" @: A+ E' ~# f
padding: 16px;8 ]' K# {5 ~. f5 q' u9 N. C4 j
}
1 z$ O6 A7 ~5 L; E l/ h6 y) ^( Y! ~; k% X. x: D* M N( z! R
/* Full-width input fields */
- O/ x! I- ~( K9 @, S! n( e input[type=text],
! r! N8 f; q# r( v+ k input[type=password] {
- \# u: d3 i I/ U; }3 e* `9 h width: 100%;
7 a7 e$ b4 o+ n* c! f padding: 12px 20px;
% m8 @! X3 o+ Z2 {2 s9 D margin: 8px 0;, b) |' [1 x' B. W7 g/ \/ k. S" w: T o
display: inline-block;# W* ^6 I' p% E$ E& q$ X
border: 1px solid #ccc;/ j) P# r. T8 w/ o, z8 M8 T7 S
box-sizing: border-box;! ~% G( a$ Q5 @+ j( l
}
& S/ k. w0 U" b- O' J8 X0 l G) E; q# E
/* Set a style for all buttons */4 o6 N- w& ]. _. B- Y# q, u
button {, O, v4 S( S6 H( S# X9 ?
background-color: #4CAF50;' m( d0 _8 }5 m3 J7 m) @5 g
color: white;1 T8 z }! n% T0 ?: H
padding: 14px 20px;+ o1 q; s4 a5 H2 ]
margin: 8px 0;
7 R J4 P5 r- E% l/ a e border: none;
% m: i$ s4 M+ W5 [7 J' } cursor: pointer;# {4 t+ O1 L* v- P0 A
width: 100%;
$ x7 s2 b0 d* O& L& M }
3 ]& F/ J. n7 ^; |$ M( A) o8 n: ]2 Q" L
' y8 }5 X. f* j8 J' u- V button:hover {
, D& ]$ G. y3 }5 J4 i: q opacity: 0.8;( W4 z H0 X$ q* ^7 t8 ]! ~$ k
}, h# b4 U. U1 Q, ^
+ k- Z3 O" @% _7 ]3 I& Z
/* Add Zoom Animation */
: Y# b. w' A/ q" n: d' W S0 \ .animate {7 x5 [( W3 D) H; T. t( K. \
-webkit-animation: animatezoom 0.6s;$ ?' ]# p; ~2 {# {: J: }
animation: animatezoom 0.6s
i8 `. V# K+ q% h9 e# J. D; g }: v! ~" U6 w/ J8 D$ d
% Q1 d$ l3 a" k# m6 ? @-webkit-keyframes animatezoom {" ~+ K8 V" m5 I& \0 | j$ z
from {- t1 ? p9 ?7 X. x8 v6 v8 @, t
-webkit-transform: scale(0)
! L# `4 t# C6 R9 Y' L3 ^ }
. d V# [3 t% T, s |
; q: d7 r% O" H& b" T- c: j to {9 M! w5 D! c1 ~; K, o/ ^, R
-webkit-transform: scale(1) y- g1 S- N$ w7 ~
}
- Z# R% v' u6 T R2 s+ [ }
, Y r, s8 O7 I r/ _8 q# V/ r
; f- X9 D+ E% u* |. @- C @keyframes animatezoom {
8 d9 _4 V5 w8 H) Q) R from {
! E+ z+ m6 i" F8 \; X% Z$ p transform: scale(0)
0 c: K' f: i2 ?# { }
, K2 T2 u$ W. b
+ h$ h- g5 ?. o" A* w to {
' E: `4 X- z; A) l+ \9 g( }3 K transform: scale(1)# U9 ^+ E- E) e5 n/ e2 p/ T
}, ^+ R/ Y( ?6 E
}
4 z3 p0 a1 \4 x /* Change styles for span and cancel button on extra small screens */: J+ O* t" K4 @ D4 A6 f9 m- o
@media screen and (max-width: 300px) {
0 x( z* ]) v- T+ N span.password {
) ^+ k0 `, r) e0 O- Q' r display: block;
- j* G0 w, k+ r- ~5 ^/ i# R float: none;7 n# w2 {& k7 c) u* K( J- s# Q
}0 ]! j/ l6 E# U9 P) w& w
$ }$ z7 z* \6 @" _5 P4 ^ .cancelbutton {
# q Z( T( J0 Y$ y) x* S width: 100%;* ^1 I) n: I. @* j) B
}
Z" n7 w! S* W! S }# y L7 U/ r' s1 K! O% U, A
</style>
( C1 r) w( a9 `' X</head>
, q6 e4 r: Z/ t1 o& |1 y% _6 s' C* h
<body>
' B- f( n/ a5 g( ]* t+ V o
6 b: y3 T) f# r9 _+ Z# [0 {5 b9 ]0 N <button id="login">login</button>
3 b, Y1 H3 I4 b( h <button id="register">register</button>9 f6 m- e6 O4 I( Z5 M" }: k; t
: G9 S4 g! u" }! X$ B' U6 J* ^
<div id="formPanel" class="modal">
& c' Z1 u& s! M: N <form action="./img/logo.png" class="modal-content animate">) b: ?, m* p3 F/ F
<!-- image -->
% M9 | s$ M9 Z& C <div class="imgcontainer">
( C' I4 f, \+ V <span id="closeButton" class="closeButton"2 o1 N: L' h* b" |9 o
. O% ^2 W9 r: ^5 l" F8 X- h7 Z K
title="close form">×</span>) }1 x" u3 L! U: L
<img src="./img/img_avatar.png" alt="avatar" class="avtar">/ u' s3 W0 x% ?- m$ q2 |7 U2 B
</div>! G0 w7 @( e9 h- x7 W
<!-- information -->
2 @& e6 A' ~* Y8 [% W7 T1 d <div class="container">
4 d' \: [ V9 u5 O/ l <label><b>UserName</b></label>, e2 j. u2 z/ M. Q/ A* j1 X
<input type="text" placeholder="username" class="username" required>
- k5 c6 u* O* T7 Z! H <label><b>Password</b></label>4 t0 N' F6 c# t5 Q! k: _: H9 u% y
<input type="password" placeholder="password" class="password" required>
5 g' I* p( j$ Y6 \ <button class="loginButton">Login</button>3 `" K+ m W7 E
<input type="checkbox" checked>Remember Me
0 l8 t. a! u" C; T; A6 w! O4 { </div>+ q: w7 f5 m% f9 q9 Q7 _
: n( o: [, O- a4 x <div class="container">% b- ?" I/ g" V2 y" N% f
<button class="cancelbutton" type="button"* c+ a0 x# e' @2 |4 M
>Cancel</button>1 d# x% Q, J% O& c1 W
<span class="password">Forgot$ y5 V# O! ]; Z! i# R
<a href="#">password?</a>
. J& T% p( O W5 D2 b4 M, H </span>- M' d# |8 n& @9 S. y. @
</div>! ?7 E5 O6 q: ^* f
</form>! K/ ~6 p9 w- _
</div>3 n2 Q5 ~+ [6 a
% C6 J4 g- [" W
8 y7 k9 @4 {$ c3 m2 _# z <script>
3 M! h6 o! ] [2 ]& \" I
/ n: C5 Y* I. a" j, v T function loginForm() {
6 ^/ B5 ]! m: i% L! ] var formx = document.getElementById("formPanel")) P; _# Y' y0 _
formx.style.display = "block"/ f# c" Z) b, E i. q
}
( ~4 K( P: ~. q; h: A </script>- h" X$ c* y; e9 W
7 a" ?5 @$ a5 b0 W% x3 w* v6 w4 B9 C0 h
</body>
7 |, @8 a" {, T& @8 H9 E9 j
+ V, B6 J) M% o2 u</html>[/mw_shl_code]
1 v: E; z3 I# S% i! a9 k+ v1 Z1 `( C" {+ w, X6 k4 b0 S2 T
1 Q1 Z3 [- d8 @! b/ P5 E
注册代码, ~3 ], b( U5 }% `; P5 }2 V
& P; J( N+ @/ R6 ?3 k% l
[mw_shl_code=html,true]<html lang="en">7 L! M" D) c4 K! x5 n# l
2 p$ @6 u8 @3 E7 E<head>3 g9 z' v' X* d& P
<meta charset="UTF-8">/ }) M) s: g1 Q& Q, P0 D, s) p% U
<meta name="viewport" content="width=device-width, initial-scale=1.0">1 |" s% a% O( J' E: t
<meta http-equiv="X-UA-Compatible" content="ie=edge">
~( X6 P) y1 ~* ? <title>register form</title>
' D! \3 y: S6 P9 w8 \+ u' Q
: ?8 {- S0 }. c# y- A Q9 L <style>
( Z1 | J* U* Y* i .panel {
5 f2 F% m) R2 t/ y; F" ] width: 100%;/ ?% Z, S3 w7 a+ w% a6 K
height: 100%; }. R* j! Y9 B% @# D
background-color: rgb(0, 0, 0, 0.2);
/ ~7 I; X0 c5 e7 ~4 a padding-top: 30px;: z. H+ N( Z" N) a, I9 P( z' @
overflow: auto; Q; r) u% V4 Y" L
position: fixed;
- W5 B, d5 B8 x/ N- i a left: 0;
- _. q4 L7 I! I. I& d2 Y: C right: 0;2 C0 T* ^3 \* q) `
z-index: 1;' K1 l& s% D+ L
}
/ L8 h- _' Y) W! N) R4 w9 j! n4 M2 U8 y
.modal-content {" }! c$ ~( x; P
background: #fefefe;
) i* O2 a$ _+ v6 i( u" u width: 60%;, P; N M% z! r7 G3 F
border: 1px solid #888;
! |9 }* T; w. r* V+ X margin: 5% auto 25% auto;3 p$ y7 C0 u- n& w
) r- v3 n7 V1 I( {# y$ i
}3 B/ V2 h' F" u3 S \" Z2 s7 D( R3 u1 D
# x' X$ Q t& B5 U .container {
' G/ M0 a7 @5 O# ^; T padding: 16px;
. |8 I; c# ~. Y8 X7 f2 ] }
}# g4 X9 ~! K+ e- M. S. M& J, W3 X
.close {; D R3 e3 g2 S' d
font-size: 40px;7 q1 \- z, P* ]( p1 n3 Z
position: absolute;; Q9 H( ^2 S' o, z9 M7 S
top: 15px;
3 R% e1 c! H& f. m right: 20px;
1 u5 S b+ q% G# a3 |6 K }
& v+ a( m3 f7 t
% |& W! w) W5 Q5 r& d .close:hover,
1 x( {& c& s" i/ { | .close:focus {
% G/ D ?9 A- _( k9 c1 d- {! C0 i7 l color: red;( l" W' S# ]/ N8 ~& N
cursor: pointer;
$ A( k. E: \( E% R }: A) l# k1 P! K1 E! W
1 M! u8 H/ @0 {8 Z% i input[type=text],
$ y# Q8 i% t5 s9 n" W input[type=password] {* I9 d% e7 c) O3 ?7 |" ^
width: 100%;
9 u& H r1 p( a) m padding: 12px 20px;$ k( q2 y: J4 {% I
margin: 8px auto;9 ?. ~" h3 R% c5 Q A2 p# L
border: 1px solid #cccccc;
( |. G4 y4 ^ M3 ]" q display: inline-block;
6 e: p* g; D# O" [- h }
: P( o) C6 b9 v4 v
2 |0 i0 `9 p+ i) M% V$ ? button {
/ l5 K, }9 q! c6 R background-color: #4CAF50;3 C9 D$ y: Q! c' l% I5 b, {
color: white;( U! I5 {0 B& g( y4 ~" w& r
padding: 14px 20px;
3 f$ F8 Q/ e& W7 n3 K+ a margin: 8px 0;8 `) X+ u" ]/ `3 z1 d1 u F+ n2 O
border: none;
8 E$ Q% N7 p0 v: ~ F+ f4 _ cursor: pointer;! P4 B# Y$ ?9 i/ I: t
width: 100%;0 n0 K: `9 O+ J) ]3 ^$ `8 K
}
9 t& S% |/ |- O! e; [& a
2 q1 q! I) _) V; E0 P: ~# b .cancelbutton {( H- b I5 a6 a% E. z0 j3 E, C& B
padding: 14px 20px;" t; d; y( N2 i3 G# t. F& \ I# {
background-color: #f44336;
. O4 x. P* n% l. C! E S3 u }. T6 k- P z0 v2 G* G
9 l2 o$ u7 j2 |3 j; U- S .cancelbutton,
0 C I9 B" x; Z1 z- T .registerbutton {
9 }9 U( [% |" q$ x# e float: left;
6 `3 Z. I a; s- u* | width: 50%8 f( T: ~. k! s% j- g2 m+ M
}; b! }$ M8 R" d1 h5 Q
9 S4 g6 }3 K! x
.clearfix::after {
4 H+ F$ k, N+ x# N/ e1 \ content: "";7 M+ n" z! m, x: `- [, W8 s
clear: both;
$ `+ o( r; k% @$ n6 g display: table;% ~! U' Y1 h) ?) E+ `4 I5 ?8 o4 H
}
3 Y/ A, D& A5 R+ W4 m1 J </style>
0 N4 F" J% I- i. r
2 E( ~- c9 @. ]6 n' `( R, e5 [2 \ u# y! x- g
" ~0 x0 } B, g* m- m+ E
</head>
3 d3 z+ a: B$ T \
6 {2 r1 k- P P# L' y/ g<body>" k2 c) i% g+ p4 W9 x+ r2 ?
- X2 P& [0 G& ^( ^; k3 j2 h2 J6 {! U <div id="modal" class="panel">% S% S1 q+ X0 u0 q" A
<span class="close">x</span>% Z) `- _; I" g6 Y! C0 t, }
<form action="#" class="modal-content">+ N b! ^5 U- L& u! {
<div class="container">
) H5 Z/ v- u7 b/ S, f/ I) [ <label>Email</label>( T- q7 `* p' i# `
<input type="text" placeholder="Emmail" required>
* B' K+ M# U7 O! F" V <label>Username</label>
3 V4 ?3 R3 @3 f4 n2 f- _ <input type="text" placeholder="username" required>/ I# Z- P1 t6 f8 |1 n7 i) L, `9 H9 V
<label>password</label>
; M" r$ s$ R4 D7 w4 v <input type="password" placeholder="password" required>' m6 a* I( M9 q$ r8 B" L O
<input type="checkbox" checked> remember me5 ^6 i( X2 g/ y
<p>Follow the policy <a href="#">terms & privacy</a></p>
+ ^6 e8 w; H. F4 R0 Q
8 m' G2 p8 _8 u/ [. Y$ z; u8 D- M5 f" |& Y6 t1 Q
<div class="clearfix">
# j/ H$ h) p2 h. J$ R) q: u <button class="cancelbutton">Cancel</button>
; [, y: Z# D9 M; E3 j) c7 J# s- B <button class="registerbutton">Register</button>0 q C( \- z8 V- D. M# w2 P- ^
</div>; m' G" H; f& x X. Z# |4 a
</div>) h/ `( r3 ]/ J4 i
</form>
/ P6 p6 n$ ^7 w3 I t6 G </div>
8 i6 m& |. d# T4 G, u6 ~0 y! P7 K1 Y, V u$ e" Q. q
! v- x* S, k; D
( M' y! @, p$ q. {& u1 ^$ I0 |# n/ S
* @! A( ^" R8 ~; m
</body>
$ [) x6 A) K0 U" H Z9 X/ I; R4 k' \5 P+ A; I3 g
</html>[/mw_shl_code]9 N+ K" W) b$ z' J
|
|