|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面: a" @# _1 z+ p, ?6 q0 Q( F' V3 u
8 s7 R! Q/ a, f/ D5 l* s" e1 m
1 }& Q+ F& w/ w7 L0 [3 v
登录代码:
# a/ |. a0 Q W5 i# _- i9 P, p, a' \
[mw_shl_code=html,true]<html lang="en">: H1 ?0 ] S9 x h5 M
7 y. o4 L1 [9 v# c0 z<head>
7 q! x- Y0 D, g, P; A <meta charset="UTF-8">
' z* z5 C- m; S0 G2 [; } _- X <meta name="viewport" content="width=device-width, initial-scale=1.0">. C7 p' X4 b( U" p/ m: V$ F& l
<meta http-equiv="X-UA-Compatible" content="ie=edge">; F" }4 Z5 n4 i: t7 v/ p0 B
<title>This is a login form</title># f5 Y6 X) | @# p
6 a9 W9 T$ ]# \, _
<style>$ X4 {; s c* p. ^
.modal {4 w/ n6 k# [2 X& f P. r ]( C
display: none;+ Z% h: b* ]% _9 E/ h: ]
width: 100%;0 \ z$ u1 Q4 _% A
height: 100%;
0 j+ q- S2 j9 W' U) h3 I. H position: fixed;! {! R e/ d( o# |0 V _
overflow: auto;
4 y, s* [8 F6 s. X4 C8 _ z-index: 1;$ F; f% Z9 u2 r3 r! O, c) R1 y
left: 0;2 P% ~ S( U: Z, E/ r; J9 W5 ~ H
top: 0;# o6 u# w; B2 ?8 k7 W
background-color: rgb(0, 0, 0);
0 l& D5 l; ^ W4 _( j* `4 B /* Fallback color */; m$ y+ ^" o7 Z# z# n% l7 h
background-color: rgba(0, 0, 0, 0.4);8 ]! L- }/ s! v! G3 E T
/* Black w/ opacity *// I% w' q: E' V! d$ x- J' `5 v
padding-top: 60px;# ~' F2 J" w3 {% K( e' v* @
0 }' m4 O$ C2 Q; p6 [. z
}
# O6 m& O' [; J8 a0 c( G7 b. T9 |: o* r- r1 k; ^- u7 N
.modal-content {& ]' m. ^5 {5 _$ j6 _
width: 60%;
9 S; {6 u" {2 C- X( ? background-color: #fefefe;
: V" ]! F* g% v4 {' {1 o/ J margin: 5% auto 15% auto;
! w. ~. K, m/ Y0 C7 v border: 1px solid #888;
% W/ S3 I" M( B1 Q- W! \
( Q0 T8 Q0 B; P' g( } }5 k; o( m# a! |& w& }! M' R
+ s) @! G7 T8 T! c; t; W /* The Close Button (x) */4 a& J( \- Y$ E# q7 _
.closeButton {
9 c+ p! p, p" F" q0 {7 i position: absolute;
# D- b4 w0 S. r. f' ^0 s1 b" R, w, j right: 25px;
8 \' S7 C# F1 g0 g6 u top: 0;# a# a2 N# z- u& q# r8 H% t
color: #000;
1 {7 b8 D( j3 ^3 a font-size: 35px;/ t- N/ h5 ]3 v/ c
font-weight: bold;
3 U% s6 b% U0 h: _: Z! L( s }
+ n" Z' t6 B, {4 l; V) @ W4 P- S+ ?9 m9 e; z$ \
.cancelbutton {' F) E: k4 r9 g: Y8 L
width: auto;
9 p& Y3 M5 g9 z( {5 A+ Q padding: 10px 18px;% q, H0 t2 R9 i: W V5 I8 s$ Z
background-color: #f44336;
- G4 {* X7 {, b' E8 Z }
- O% Y7 _3 X1 [. A9 M* ?( I. `4 `8 `, S
m! t; h" X; P+ B span.password {8 M3 d Z2 L2 }/ y# n. o/ H
float: right;
1 } U% Z1 z1 R+ s$ i padding-top: 16px;) x, C6 @) G. J! p `* O
}
% B1 B" z ?: ^( J5 o( W
/ x+ R: n. J) k$ b .closeButton:hover,0 F& X, h8 B1 O! A9 e' O$ c+ g# L
.closeButton:focus {8 v! Y# s% A; q! A9 ^, H
color: firebrick;( ]. M" A3 W0 [1 T' a7 ]! _0 K
cursor: pointer;
4 ]- c; N9 F3 O# w& P$ b6 g5 f q, K0 y9 a9 `3 o* Z! C2 a1 d
}
J6 S% C5 A3 K* L; Y' S0 e9 X/ F6 G3 i
.imgcontainer {
0 i7 t q: Z# j% I8 y text-align: center;4 Z- n- s+ k; n# |( p
margin: 24px 0 12px 0;9 U& G Z2 C9 U! N
position: relative;5 I5 i$ w* {4 @3 P2 S1 \ D
}
3 y1 }3 i) J# H/ M8 W& w7 l5 l9 n& X
.avtar {
6 d- k0 T" V( y. y% o width: 40%;
" v3 u- Z' c8 g' J3 u border-radius: 50%;7 S B* w- H5 k L+ W4 E1 X9 T
}
* u7 \8 L: ?, ?# b J, O) Z+ t4 Z6 `: ~; i3 T6 u* o
.container {$ @/ n5 J% O8 N8 D
padding: 16px;
9 K. t" v; E; F$ ^5 X }
' y4 ?, H2 a V# e* g* R, z. {* R' s) y$ @
/* Full-width input fields */' w6 @. v* L) T" S- n. W2 Y( b
input[type=text]," c* n" F3 n1 L% l$ c( t
input[type=password] {1 O* p2 v* q, B) d
width: 100%;
! m2 ~: B; z6 a0 t0 @, W padding: 12px 20px;
4 o1 b* J" {, r( Z margin: 8px 0;1 Y5 R1 d+ J' ?- e3 q3 e' C) j
display: inline-block;- ?: |9 x0 T Y1 @4 K, @( e) i
border: 1px solid #ccc;
# t4 K3 `0 m/ T; U8 y box-sizing: border-box;
/ J" p; K% C' b X }
1 f4 {# E- i. X0 x( o8 p
0 ?% J1 Y2 `- X /* Set a style for all buttons */1 f; `) d2 b$ ~2 d4 E! G
button {
8 @2 y8 z% @; [& o" ` background-color: #4CAF50;
; v* @1 b( G/ c' `! Z5 f' I color: white;6 C9 z5 T3 w" |$ X1 C
padding: 14px 20px;
) g: d9 i2 @2 P* K& P7 u margin: 8px 0;
& V# v+ s; l' ^ border: none;
K. O+ m0 C% A cursor: pointer;
0 K" L9 i1 r6 F: ~ width: 100%;
3 h+ s7 }' T, P! Z! a4 G1 ~3 m0 s }5 h/ m( a8 i# l) j- Z
, P. |- G3 r8 D7 S: G2 f# ?) H! {# L
7 m# O- n6 _) T$ V" c6 q, E button:hover {
3 j( C) [; U* S* i: _# Y opacity: 0.8;
: u1 F& J7 n7 z8 ?& V }7 h8 t/ @: g' O9 A1 H* }
+ I ~- i, b" } /* Add Zoom Animation */
' A5 w6 A/ S* v: R3 l& O* }0 f .animate {/ Q' \& i* y6 ?" Y
-webkit-animation: animatezoom 0.6s;
5 K/ U k ] }+ Y& H F animation: animatezoom 0.6s
8 J" h$ x4 J+ f8 T; j* Y }) F6 x9 _, O; L5 a! o9 E5 U# O
6 ?3 Y! m* n2 ]: _; _$ @4 V
@-webkit-keyframes animatezoom {
0 Y9 C9 E' c7 s: \2 x- `- g r from {& x& v2 U V+ K
-webkit-transform: scale(0)! v$ s$ ~5 I! s
}
% T) h$ H9 [# v) M% h- \ U* d9 G, q4 R$ a3 T+ ]% g
to {3 V: V7 ~. [1 B% e
-webkit-transform: scale(1)
+ H @1 Q. N+ m0 j* @ }
: z p7 B1 a0 N X1 V9 r% i$ d4 \ }
( t" k. I# G1 h& m+ @4 [ S, }4 c, Q
@keyframes animatezoom {
4 u1 ]$ J/ I! n, d/ f g from {
Q$ s$ \4 q5 T; I% {# U3 T transform: scale(0)
# B$ Z' c6 y3 z2 j1 ^ }
`& A& M7 k x0 {3 v# P. u
, `/ Z5 f; V7 g/ N: j4 G4 d to {
) ?3 p' x$ @& L/ E transform: scale(1)5 E" f3 [" Q6 e0 ^: ]$ c: A
}$ m i. [, T# y8 I; }% }6 C
}
/ u) t x* s g! w /* Change styles for span and cancel button on extra small screens */! x" S) X0 t* Q* b
@media screen and (max-width: 300px) {
3 q7 k. I6 I' |, p* _+ \( v span.password {. J4 i- {7 i" I" b6 u% z
display: block;
3 ~0 ]% ^! q* v6 K/ `" _5 }: S1 O. ^ float: none;
) s: d. R( |' h7 R* ~6 \" ` }
8 X. X& Z; R. L* d6 D& B: B7 A" U, m8 M' a8 D( l- H0 ]4 |+ E
.cancelbutton {4 V( J. N$ ~' `( \
width: 100%;9 b: f0 V" W) \1 c8 b% |) }3 z
}
$ {6 ]8 z: }: C }8 q* t& @7 m" Z8 U- r
</style>
/ M P+ \0 |0 ]- L/ B</head>5 @6 P1 b9 }, \% Q% M5 h
C' K# \# Q7 e; {) ~+ {/ M& z+ Z
<body>! v: b8 C9 d6 A
: ?1 m) {) P4 i+ \1 B <button id="login">login</button>& e4 t( J v5 @+ W8 N1 t
<button id="register">register</button>& E) G' b% ^; x% K+ I
& A# N c! P3 _5 o. I <div id="formPanel" class="modal">
. b5 {( I9 [1 _8 I5 @- M) I- Q <form action="./img/logo.png" class="modal-content animate">
2 z, m, S8 _2 W! Z0 O1 L" _/ c <!-- image -->+ @" @* A$ }# ^ l
<div class="imgcontainer">
2 ~" v( u/ Q0 Q0 R" [# X5 B, V <span id="closeButton" class="closeButton"& S4 B5 a* g& Q! Z; t
1 A' l/ {& Q l4 F. O6 W0 e" ^
title="close form">×</span>
' Q0 K) k; }# O2 C, d- d <img src="./img/img_avatar.png" alt="avatar" class="avtar">
! Z) z+ c( w# s; X# f </div>
6 k: Q0 _. N X4 O, C$ m E <!-- information -->
; Z; w& j% u: v( w' u7 H/ W( ^ <div class="container">
$ j; Y, |; g2 ^1 C0 Y# K8 L <label><b>UserName</b></label>
+ f& l( ]% N# ~ <input type="text" placeholder="username" class="username" required>9 f5 T% ^+ y; c% A7 Q: j
<label><b>Password</b></label>
) k* m( g1 y e6 T0 ^1 e8 v6 E j( E <input type="password" placeholder="password" class="password" required>
; i4 K3 x0 H6 T: D9 d" O <button class="loginButton">Login</button>9 m) x m; k0 w$ T$ `
<input type="checkbox" checked>Remember Me( |6 C) q) l. V) ?# n4 ]7 S4 ]
</div>
5 W/ @; |/ z( i" b2 R0 X
1 @6 p5 M3 Y3 `. c+ P H$ \ <div class="container">" e* P8 k; W8 ]7 b4 G8 k1 U$ m
<button class="cancelbutton" type="button"
& h6 R% P. E% ~* y0 R% d >Cancel</button>
0 B& W8 Y/ v/ z6 |! h/ B2 z; h3 f; e <span class="password">Forgot1 A8 F$ {+ E. I3 d% ~/ S
<a href="#">password?</a>- [* _8 j8 u# y
</span>5 \0 Y2 {% s: S) H3 i
</div>+ Y+ q, E+ ]: G
</form>5 o) t" F* q, a/ ?$ W2 Y/ z
</div>5 J3 d; T) f9 b2 [
0 g! H8 n) U1 s, n' h! l
! n# b+ R2 j! f, `! x
<script>1 p5 p4 e0 B& r! l0 W# H8 w
$ k K7 n* o- y function loginForm() {7 r1 D: L! m9 I7 [. h% Z
var formx = document.getElementById("formPanel")' r" u; @" t: _, l9 l6 R K
formx.style.display = "block"2 U7 K0 o4 c& p0 u. I
}
' ?8 x( q G- q </script>7 \$ O4 m* X7 W2 u+ ^% u8 w
% Y+ P5 G# F! A2 N" f6 w/ i9 M7 X3 b Z2 G+ O' g; L$ Q/ F
</body>
! b/ }- H1 V* [; s* g- H" ?+ D/ E
</html>[/mw_shl_code]5 n z, M( [3 I" R$ S; k
+ l/ f2 F1 g. I8 @' t! V5 o' V
注册代码
w* @, I* k$ `* f8 r/ n l
/ L" ~) U/ B" h% _ H8 ~5 K( T[mw_shl_code=html,true]<html lang="en">
& s" R& F7 ?! `8 R% H9 r6 A% M0 y ~& f+ t
<head> a) V! T! H+ @1 T
<meta charset="UTF-8">
* I) m# E: R, g) p! j <meta name="viewport" content="width=device-width, initial-scale=1.0">
. u8 y3 u6 S' W2 C# D/ w0 H; s <meta http-equiv="X-UA-Compatible" content="ie=edge">) H: H. s/ ]' u! _
<title>register form</title>( c, Z: I8 N2 G$ T; |( R' ~0 ~- G
2 U/ u! t: X- i; C7 _ <style>
( k3 B2 S5 R5 a7 T+ h; R& R* C8 H, i .panel {7 e& X V( ?' D8 l- [6 K* y1 a; B
width: 100%;
b7 G6 F; T; D* q$ e3 A5 U height: 100%;7 }) T2 T! G2 A1 Q+ K; T. I0 L
background-color: rgb(0, 0, 0, 0.2);( |1 D0 L# Q5 K$ Q* O1 P; \
padding-top: 30px;
% p- u4 {" @' P4 Y. m5 I, \2 o overflow: auto;1 H) O9 ~) I, z
position: fixed;$ P: r* u, \0 k; U5 ~! I% M
left: 0;
4 t4 ?# k+ o o/ L4 r5 C% l. z* | right: 0;
R* k* }. G. Q- \) ~3 k' K# Q0 R z-index: 1;4 I! @+ @2 O$ u) u3 b) Q
}9 i7 x7 l$ t3 ]/ s$ B: [1 X6 i
T6 `, X' b6 y+ }4 p8 [ .modal-content {2 U( {6 W1 v. o5 S6 B! h
background: #fefefe;* {2 Q2 m5 C9 S3 Z
width: 60%;
# V# x* ^) I" f/ J border: 1px solid #888;
4 ]8 G" _6 {" g: C+ E( F margin: 5% auto 25% auto;
3 O. z! P) _2 Y9 Z
' a( |3 g! e( w4 Q$ M6 X8 e9 a }! W% h; Q" |' K @
: L# f& i; {1 H! R
.container {
0 ?/ b9 m. I% ]* y+ b% |. T( V( J padding: 16px;: d: \ e8 ~3 v$ o8 T4 W% s
}
4 A/ R) f% E# [" V9 i9 }8 ^
' X0 G# E9 ]: w& J$ W: c .close {
( n6 }; ]8 ?2 t y! U( q% M font-size: 40px;
- |% Z* |) o6 L. d5 D) n position: absolute;
& f+ T& |5 k+ r4 I1 f top: 15px;1 ~: D; D7 ]7 D* @
right: 20px;! h( b6 q7 h! s1 H
}8 ]! t$ i( j) o& T
" q3 ~: j8 L% T8 [
.close:hover," u- m1 G; v: g# ]2 t
.close:focus {1 J8 A6 ^, |5 a7 z% D! x5 K
color: red;8 s, c. K. \/ t9 X4 \
cursor: pointer;2 B( Y7 G- ^) p$ X, `
}
3 o1 Y9 g# e, k& k- d- j4 @' U% T# t: c( H
input[type=text],
6 v& @9 t& ~) ?: a6 [$ m# ^ input[type=password] {
' ^' e9 M9 W7 x8 n1 Q: U% y width: 100%;
" P3 U" M0 j6 P. Z' D( D( j: \. ^ padding: 12px 20px;
+ W/ g1 H' }. f! J; H% U$ ] margin: 8px auto;$ n' J& v \, @- n9 @
border: 1px solid #cccccc;' w/ K% K7 Z8 G$ V
display: inline-block;
7 z& d. ]5 X0 g/ | }1 u( U4 R D, ]* K6 F) }# `
" o9 e5 l0 n8 g$ T9 b button {7 c: a; j2 e( e
background-color: #4CAF50;( Y( P" S" I1 I U% ~' k* ^
color: white;. A! E6 X7 A/ ?7 c+ h
padding: 14px 20px;+ o" X- {' s' ]2 ]( I* G& u) W
margin: 8px 0;
! f5 R! X) v# `8 N4 w border: none;
* P% }. N8 ]' p8 { |7 U; W) q cursor: pointer;
* S" s$ u( f+ h0 j1 O+ q" y) ?5 z# m width: 100%;
: k: N# G! }& ] }4 {9 u$ Q/ J9 t, b7 n4 I8 {
9 E9 H! E) \; Y' s
.cancelbutton {
+ B0 |2 U. T6 m) A- q0 R2 e& H padding: 14px 20px;/ X/ s$ R3 k. _5 o% ?# e
background-color: #f44336;1 D& n# _7 v: l' E( g
}
& N# T0 P. i! [% C$ z
) F7 }$ W, R/ {' b' x |$ U8 Q. m9 L .cancelbutton,
( Y3 }1 p4 N" J* g* D .registerbutton {- a" s1 o! `. r- e; y0 I
float: left;% F2 i: t! Z* n" N) L% }3 f5 @
width: 50% U. K# j# g/ v8 G* s' H, J
}
9 C# W8 ^2 [+ a$ ]* ^- l3 u2 m# z- k7 v$ v+ Q
.clearfix::after {
: U6 N. a3 U: s7 U, o$ g5 K content: "";* {* y p. x& v4 D
clear: both;6 [& E) Y) J. ~8 F
display: table;% ?8 g2 A I3 G3 ]
}
* F6 @# e8 H$ i' I5 Y* B' ~ </style>: d y7 Y; _4 F3 M8 g
, ? V7 C! A1 O9 h1 S) M H$ c- r- [9 ~& h0 |' t$ L) F% J
* C. H6 a! x' n, s) E. Q) M: U* h' K
</head>2 k6 h) C( Y: [, I
" N% V( g2 v' j* l1 M
<body>
3 Y7 h+ t% T. \: g% p! _, E* l) T# B4 s9 O' R( F4 h
<div id="modal" class="panel">. T! `- Q0 Q$ B8 N Z2 w+ r
<span class="close">x</span>: A: z Q$ I, g8 k7 ^. a' @
<form action="#" class="modal-content">! H- L, w8 @9 u- d+ b% F# i3 R
<div class="container">' M5 w5 {0 m5 r# k2 \$ ?
<label>Email</label>% r- U! f* {5 E
<input type="text" placeholder="Emmail" required>
! h# S& y2 x/ L( a <label>Username</label>
" X$ r& n- i; M: g2 Z <input type="text" placeholder="username" required>
3 J/ }" |6 U- \ <label>password</label>) ^9 U7 e; j: g
<input type="password" placeholder="password" required>
4 d0 f- d5 j6 A1 {* P$ ~1 c <input type="checkbox" checked> remember me- N2 C9 ~$ w n) M8 Q/ h
<p>Follow the policy <a href="#">terms & privacy</a></p>
5 w* i) G+ q% t a# j$ D0 X( [& Z* v0 ]$ X' D% g
9 K) z. |6 f( t- e <div class="clearfix">$ [8 |. m: |7 K8 @& A; m, _0 _
<button class="cancelbutton">Cancel</button># R5 n1 E0 k3 p# {2 o0 o1 F
<button class="registerbutton">Register</button>4 ?7 |0 s2 I ~& l
</div>5 {* Z) P2 f$ [! ~' R( B
</div>) ^) y t8 D5 R% @( j
</form>
1 |6 n! n0 o( @ </div>0 a0 ?* P- X4 r6 A8 w
6 q. K0 l+ E/ I; I/ |5 t, e. b1 F" v9 f" i2 V2 y- C7 D% N
# Y0 H" W1 M- l% w' ~: J4 R7 r
2 q; o# _% A" Z5 {
3 `9 G4 n- V! O: O4 a, j; P</body>/ r. m6 V7 ^5 N: e: M1 W
& P Y, Q- W8 O& V
</html>[/mw_shl_code]$ s% W) }. t9 l
|
|