|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的登录和注册HTML CSS开发页面
3 ?* {6 N2 b) c4 `4 y9 t" F" Z1 u0 s) e- Y+ }
% k+ }( M8 C$ c; H
登录代码:& A8 P: W- Q0 a3 \ O( f7 a
* Y( z7 E& R( {# `[mw_shl_code=html,true]<html lang="en">' \' w1 S9 E3 d: Z* u, W1 F6 O- ^7 p
! F. }5 ^+ m# Y) k
<head>
7 `9 t# Y# @) @& q, I& C <meta charset="UTF-8">
& x* ]) W! J$ H0 O1 A# X; Q <meta name="viewport" content="width=device-width, initial-scale=1.0">
. E6 C$ _$ W, M ^3 w/ g: V; o <meta http-equiv="X-UA-Compatible" content="ie=edge">
$ E. H* `3 ?; O; X. ~ <title>This is a login form</title>
* \; I$ _- e/ }7 ~* f
& Y! [; [8 \5 W2 v# G <style>
$ e, P. G+ x( `# e5 h .modal {- R1 P2 m. o1 e. ^" F9 Y
display: none;4 d: x4 f+ E1 s1 |, H. f
width: 100%;: n, d2 r4 b" q! \: E
height: 100%;
5 \9 T% {5 Q+ k. T! o" l" U# n7 a' q7 A position: fixed;
$ d G3 [ C+ v overflow: auto;/ {, k$ ?9 y/ c5 t) x# ]$ s
z-index: 1;: N+ C7 {$ }4 R I
left: 0;% t1 t; O/ E" @+ S3 W+ V
top: 0;
u9 L1 G5 {" w4 g! c background-color: rgb(0, 0, 0);0 a5 F. k+ N5 Y o( m- `9 F+ E
/* Fallback color */
# l/ @3 C% O! k P7 ~7 H% n background-color: rgba(0, 0, 0, 0.4);' R; l4 r% z2 J* b$ v$ y8 Z; I5 E( N
/* Black w/ opacity */" ]: B' ~2 I9 |9 \
padding-top: 60px; `) x4 }2 E1 h7 x o4 n5 V1 l( O
9 Q& A9 p6 A5 ] z3 D3 E } [$ T! W2 E- A" D, W' S9 L% p) I
3 w3 e$ U# s- \+ }) D
.modal-content {
0 C9 Q2 Z# G, [7 b width: 60%;( b4 V7 |2 d/ W/ h$ f. P; A
background-color: #fefefe;! w U8 W8 j2 _* i! W G
margin: 5% auto 15% auto;3 U( A4 O3 i# \8 y4 b! g6 b o
border: 1px solid #888;7 o- v1 X2 R0 `, z2 j
" N/ `( C8 r- J+ y
}
8 b" E9 P/ m& v! A* x7 ]
4 O7 j( _ I! I. g /* The Close Button (x) */
/ X. z9 w# H5 O: k( C% o2 ^ .closeButton {
: h& F" w) L7 E. w position: absolute;& }1 R d9 |! r$ {0 O2 q
right: 25px;
1 o' N+ i9 P4 A6 ]# ^; l6 o4 Q top: 0;/ B* l, p: p% S" r" }, m2 p1 R5 w& `
color: #000;9 G4 F' z t3 V. R
font-size: 35px;8 ~4 \9 m. k/ H- i9 z3 T3 X
font-weight: bold;) U* R% G9 v* T8 i" D8 J' T& e
}6 g/ o: {, E( g
) H, r+ ?6 n, P. M- c. V .cancelbutton {5 \+ F8 B" }- _- ^2 Y! x
width: auto;
L4 J7 T2 Y' U/ _" g padding: 10px 18px;% _3 C! {# B5 d; I3 A+ @8 C0 e
background-color: #f44336; o4 U! ^/ `$ U/ ~! v2 T
}
% Q% w: T: E3 [+ [0 V' g4 v: G4 P# U6 S" x8 _9 H# {9 T
span.password {5 c% i- O; X6 `$ Y/ S+ F3 P/ h$ x
float: right;% Z' g0 \0 a6 I; b8 w0 [6 o# F
padding-top: 16px;% B% ~( S6 V; R+ }
}! H* j9 |% o( `1 o" [
, i- |7 P$ U, Y. I4 |$ J' X .closeButton:hover,
6 }% T4 S5 Y4 S; F8 n5 D .closeButton:focus {
6 K5 Q! n* Q @ color: firebrick;* H' O2 ^! t, S# M! A% y
cursor: pointer;
: {! k& M3 ~ r
& H( s" d3 ?4 q" I' q/ e }+ i- b& X, ?3 K; g: p2 v$ I
1 A/ p$ |) D, o/ D& k+ H8 Y
.imgcontainer {/ |4 x; i) M. l% Y5 s# w
text-align: center;
* g! r; Q, B/ B1 L margin: 24px 0 12px 0; f; A) v% ]2 {2 K5 l: P+ Q$ ^
position: relative;2 I/ |. s8 L# L' p
}
; I0 s7 j6 j, m; T1 |5 F8 Q# o+ C
& k h, S% y. x& j" q .avtar {
- F$ ~" l$ J& V, v$ ^ width: 40%;
C; w0 W4 p0 I8 W) d5 s# T# H border-radius: 50%;+ P/ [% H5 |: m
}% M1 f' u5 j9 i P' P
. c4 ]0 j9 j- r: U9 Z3 K3 [ .container {& |- b, L, e5 i# |
padding: 16px;
( ^6 r+ H3 F+ E }
1 F" S# F# \5 `
% l) `! ^0 [) q* m; M) S+ L /* Full-width input fields */$ \6 L$ Q1 \, ^# g4 s9 x- \/ U# \
input[type=text],- m$ {) [$ h' S+ N3 O) h0 n" _
input[type=password] {; w' f! `. s+ K2 y: w
width: 100%;
0 p# C8 x, B! g+ v) f, Q padding: 12px 20px;
/ X! o9 j( F3 s' s3 W6 r% M margin: 8px 0;
7 k. Z2 t/ ~4 h+ D, E1 r( A display: inline-block;5 Y% W9 S& H( j0 @/ S: _
border: 1px solid #ccc;& ^3 r6 y7 d. r1 d& N
box-sizing: border-box;
4 N( M2 q3 g# ~/ g6 ]$ y }
% a8 t' r D# T+ ^& |- ~2 ?- `7 V' T& e& p5 Q4 A
/* Set a style for all buttons */
; y5 p5 V- s% u6 @; M" V4 U4 R- u- g button {
$ f/ i1 d' ?* p background-color: #4CAF50;
, D6 |* u8 ]% K5 \: i color: white;
- q' F0 q' m/ S% l& I# \: D padding: 14px 20px;# Z6 W! A; `. W6 ]% \
margin: 8px 0;8 B$ f8 N3 n: G9 j; G/ G5 {4 z0 H
border: none;( z( {* x" M u* ?2 Z/ c' Q1 `
cursor: pointer;
* c9 b' k) r$ z# | k8 Y s width: 100%;% u3 `* B6 k' ^; ]9 U! I8 r
}
$ o. M, X8 b( @# w- Q: Y3 _
8 [& s. A1 m! E+ v0 S% W' t+ t9 h$ `- O9 F, f9 p% l
button:hover {0 \3 S" m+ n* X6 F; Z% \. T
opacity: 0.8;
. J r8 U Z0 J ^. _% R( ^ }" x0 }- }( Q: \+ I5 \0 ]
- h0 N/ q8 r% l# S) V7 g2 j% ` /* Add Zoom Animation */
% R. ]" q& e: `! F3 G% y( ?; s .animate {
8 Q4 M- p* n- y1 h -webkit-animation: animatezoom 0.6s;# ^( T+ o9 k/ k2 H, I* C
animation: animatezoom 0.6s$ d! S5 M! R/ F, R) v# u& j8 [
}4 X& @6 u, u. v! d9 N( l
: v3 x, v) C2 F/ t- G @-webkit-keyframes animatezoom {
: L: Q- q. _. ]$ U$ M+ W; @ from {4 y' `& T2 M# u2 e, n6 M7 `
-webkit-transform: scale(0)
, V1 s6 [- i7 ?, D }) u' H! k8 m/ S5 u, `# E$ ^0 F. _
$ a: Y% j4 H9 s' ?; C
to {
. ^. r4 a/ |* }# M# ^; w -webkit-transform: scale(1)
$ K' ~# U+ l1 t }7 U* C( T- e+ ~1 a: h' x I
}
2 F9 i$ g+ X' h( u+ @# d& N+ o& u2 c2 w `; O
@keyframes animatezoom {
' s7 s/ Z& B9 |2 R+ ~' Q3 @8 V from {% C% P- A: r0 J9 R9 F
transform: scale(0) u! Y$ e v3 ~; m9 o* I3 A) ^
}
0 q, a1 [9 K4 }7 A/ N( K+ o- h: t/ k( K' D( ~
to {+ A4 c+ F/ ~) }& D/ S
transform: scale(1)
" Y: c m9 k% _: [# g, k0 q2 X }7 }7 [; ?" v: O1 f1 M
}
2 b' y- K/ ?) Y) e2 f3 y /* Change styles for span and cancel button on extra small screens */6 Z% ~4 O2 F1 R4 \ H# x
@media screen and (max-width: 300px) { m; w; `# z+ }0 J. m- c4 O0 ?9 Y
span.password {
5 n2 H' V* T; j2 R9 l# Z display: block;
9 N/ e+ S) F4 u float: none;! L1 U5 K& o3 \* P! b5 q& m
}
- M# u5 P" p; X! \+ y; s
" [) P9 U* [1 G: ]9 Y9 A1 c .cancelbutton {
( b( S7 K( t: B7 T2 r width: 100%;
! v5 W# T" ~- ?9 }6 Y* Q }
# V% j) |; g1 y3 u8 b; J# [! ] }
0 O" i: p$ ]! W3 L- U) X6 @ </style>! ?3 P) m0 I0 A( g% X
</head>
* }8 c* T1 A% v, C: u: G
: x5 G& a$ U7 Q S8 p<body>
' m# N6 z& ~! N1 d8 e6 F: e) C& v+ z2 ]! J, w4 `
<button id="login">login</button>
0 ?9 f1 @7 }& c1 F" U <button id="register">register</button>
% m; V) c1 z* `6 t: f4 {
3 j: C" O' R% m5 c <div id="formPanel" class="modal">
b6 g d& E. _0 y; x8 S: Z <form action="./img/logo.png" class="modal-content animate">
5 V. h/ W& M& y7 Z <!-- image -->
6 p4 S! A$ F0 _9 I6 D+ l( R/ N <div class="imgcontainer">
, a6 ^) K# h8 h8 r! R <span id="closeButton" class="closeButton"4 s7 j' Z1 x# V# S5 j# u
9 N1 T* ~1 g0 s! S3 D% M
title="close form">×</span>
6 j( t! O2 P4 ~8 K2 h+ { <img src="./img/img_avatar.png" alt="avatar" class="avtar">- D& x$ k% E; E, j
</div>
! p) U. k+ g$ z, W0 W <!-- information -->) Z. q' B( D3 y. K6 X( w
<div class="container">
8 E1 o V; v$ _" U <label><b>UserName</b></label>
: S( a) ]$ i0 r! n* u: w/ H <input type="text" placeholder="username" class="username" required>, W) o# B: C8 K. b, J
<label><b>Password</b></label>; i: {0 n _7 D# c: o
<input type="password" placeholder="password" class="password" required>
. f* h. u" q, l <button class="loginButton">Login</button>0 E, @ j5 E o' }5 C
<input type="checkbox" checked>Remember Me: `- p2 e+ U, o9 [8 u
</div>
. {4 E4 I+ a2 O \; Z
9 X& D' s4 y$ R2 G <div class="container">+ ]6 {" R+ E+ F& E3 C
<button class="cancelbutton" type="button"
+ E8 V' T( R0 W/ J >Cancel</button>
% N' P2 s: ^5 R0 x" W <span class="password">Forgot
* e9 _5 r- k5 T <a href="#">password?</a>" L8 ^( d) C4 h% }
</span>
5 j5 }+ e0 Y; R. L( X </div>
) L2 z+ i2 ^* k4 n$ K% B </form>! U. C2 G0 q+ w
</div>
8 j- V& b# K" G+ ^! W" W6 v1 r: z8 V7 v1 S
+ @, | E" t. \! i
<script>
' }+ Q& Z* q: P1 J9 J0 ]0 q* O
3 C1 h$ P N$ M2 @* ^$ S! y function loginForm() {
& J0 D6 G, _2 X- Q" i var formx = document.getElementById("formPanel")
7 u* Y$ O( _2 Q7 q! Q formx.style.display = "block"
$ k- l5 p9 L, @* D; h* @ }7 a: y( d+ d3 a
</script>% W+ R$ @7 l8 S( t. W3 _6 g
+ m0 ^8 E4 `9 z/ r9 ?
( d: Y6 n2 {2 H</body>
( ?/ f8 a! I/ H% Z' d4 ~0 M" o9 L5 ?, j. o
</html>[/mw_shl_code]
* _8 _2 s. o- l/ R: [4 V7 ~7 a, o1 @( u
3 ?8 u$ ^. l P) b4 B, |
注册代码
; }+ X; s& H4 `6 x" h
( w, s9 V! w. k- c! r3 k# F[mw_shl_code=html,true]<html lang="en">
8 w7 p# }4 i2 b
' P" e' V9 T" d4 T) U) F<head>9 z- \! d5 [& x8 l4 R- x
<meta charset="UTF-8">
5 Q4 J8 B0 s% e; Z7 z <meta name="viewport" content="width=device-width, initial-scale=1.0">
$ ^. I9 v% ^ P, M% C$ \" T; c <meta http-equiv="X-UA-Compatible" content="ie=edge">7 @) v& N1 y$ z. X
<title>register form</title>+ B# f9 c. m- {" t- z
4 Z, y4 k% |/ f, f
<style>4 `# y% t9 S8 ?* t3 T @- f
.panel {
* A) X. L7 q( s width: 100%;
; D% s* K A9 ]3 g, Z O height: 100%;* V }1 L+ ^8 b1 J1 W
background-color: rgb(0, 0, 0, 0.2);0 ~; x6 w* I+ o, p6 K$ ]1 I
padding-top: 30px;
/ ~# x+ D3 o7 I overflow: auto;
+ z o# h* D7 H7 L5 X position: fixed;
y& O$ x5 p+ r0 a& t: Y left: 0;
, q, R% P% l! S# h: s4 D right: 0;
/ W6 W) g* ^' ^. r) T z-index: 1;
: F5 i; i, Q1 m9 G+ Q+ \3 M2 V; k }$ i- e& i6 n6 F4 X' q: Y. O' a" S8 O0 T2 q
- [) g7 Z/ u- R1 p* \9 L; a, X) J .modal-content {
9 Z2 z1 ~7 \4 ^* b1 ]! j+ k6 [) I background: #fefefe; {! D: O+ w& t* k% s
width: 60%;( }* I1 }9 ~5 ~8 o
border: 1px solid #888;
" ]/ ~5 u' L1 U! s q margin: 5% auto 25% auto;5 z9 U0 s9 F( {
6 l2 ^+ t0 q6 W' O7 Y5 q* } }
$ w8 R5 f. h) I9 G" Y. F; V* l) d% o4 F) Y+ d
.container {2 Z7 I) m3 {3 O/ F; G% P1 n+ k
padding: 16px;$ }( s# T+ Y% e+ C; Z+ {
}9 _: b R$ L$ ]) y' i4 G2 L8 E
. }# G: C& H1 G* R; p; N# X/ C- S .close {
4 ^8 m7 K8 j& M) Z4 M; H- h$ f font-size: 40px;
" [/ f. A9 Q2 H" ]; y2 a position: absolute; W& ~) a* r/ F; K4 o
top: 15px;8 W0 a0 `; O) i. [. r2 o) ~! f$ b
right: 20px;
1 F1 m% q% { e0 } l8 S }6 u/ }( y0 u6 Q1 Q" G# z5 ?2 z
& L9 K4 C( p2 {7 ^
.close:hover,
+ ^+ f5 Z1 x8 @: q; N .close:focus {# s' H) H- |6 R3 {% e# G
color: red;: U8 r5 r! N( i# C; O! I
cursor: pointer;
+ W- Z B9 o+ @2 d; ` }
* b0 I, B0 M$ Y" J7 a& ^* \/ T4 c5 D$ H d J0 {
input[type=text],0 r, J8 p2 }# f& _) w5 P+ e0 k
input[type=password] {
# n% O/ Y6 H$ p* l0 S) v4 U2 w width: 100%;* E8 b( f7 v. x7 I
padding: 12px 20px;
( v5 s* ^# y" Y5 a3 w, U# D margin: 8px auto;6 b5 d, e4 i- ]0 B1 C
border: 1px solid #cccccc;& ~) N4 N7 N \; e3 @
display: inline-block;
0 n9 N0 I- {. @- n4 \ }
/ Q- G* L3 V0 G `0 E8 I. K4 ?/ L7 y; B
button {
( R0 d4 V) k2 j( @2 U/ R background-color: #4CAF50;$ F9 m7 q- K `% [( [9 L9 c
color: white;1 p% `% V9 \- l/ H' y# Y$ f
padding: 14px 20px;$ S; w# v% B* c4 E ~
margin: 8px 0;
4 Y# C5 d" \2 l- a/ W7 Q4 m$ i border: none;+ R; G, v4 ^6 ^0 n' @" {
cursor: pointer;
9 J V8 Z4 k: V7 \, {9 b. ] width: 100%;
8 W- x5 X* y/ y }
( @. J+ v" l; A6 w2 B2 t* M- R* A, g5 E1 ]5 K9 N7 z! O
.cancelbutton {
0 `/ O1 K: ]& ?: J& C padding: 14px 20px;
4 S' P- B" Q& R8 a ~$ r background-color: #f44336;4 u3 u* W. y8 y8 }" O, _( C' m1 b
}
, h( b9 G! c2 P# [1 K- g1 T- P* m8 f- G1 C4 Q" c; _
.cancelbutton,
! n! y$ U: k( R9 V# } .registerbutton {; O' |$ y3 @! I2 j6 W
float: left;' k: E1 p$ V* Y2 Z
width: 50%
' c& ^- D0 Z3 }; @: s5 ~/ [1 R }
! F% F4 }& h, d4 u3 h
! \* [! g- k3 W9 N% Z! L .clearfix::after { T5 Q% a$ M( o# R7 y
content: "";
# S- C; [3 {$ S: I7 t5 o$ S1 k3 \ clear: both;
- A2 b( F+ M7 d; `& a! p1 ~ display: table;
5 Y. p% [9 P9 y- `& u }; x* W7 O- e! a8 g, L
</style>
3 M5 ^, ]7 I" P, X3 T; T; F5 _- [9 k# s, j9 c$ G) o4 o
; {8 G. e+ C: b# ~
! t: w1 T e% f# X</head>* w6 O7 G5 Z, }4 X
( o j4 i6 W+ L: @
<body>
1 p1 k) g, A% f. { K' j6 T8 k
/ A: M, O+ p H; n; e# u3 u <div id="modal" class="panel">
/ n7 g% }3 Q# z <span class="close">x</span>. c" D9 P1 {* ?. l1 I& b4 A, k
<form action="#" class="modal-content">
( ]& r/ H0 W6 m) D: \) q <div class="container">
- J% _4 k* j1 V0 ^: L8 L <label>Email</label>; b1 F* `# H& r3 L; W& E( V \7 [
<input type="text" placeholder="Emmail" required>
8 g8 w$ Q1 L% C% I) C3 h <label>Username</label>
8 U' @5 E k* w7 ?3 t' D D <input type="text" placeholder="username" required>1 Y+ t8 b3 {! \4 \: _4 L% s# h y
<label>password</label>
2 e* K9 e+ g9 e+ X5 }* N: S% } <input type="password" placeholder="password" required># I5 x9 P5 `4 H! M
<input type="checkbox" checked> remember me
9 N) ~2 |+ [+ u" \3 c <p>Follow the policy <a href="#">terms & privacy</a></p>
' L8 A) @9 l! V6 M
6 I0 q, A( ^2 P; j4 T' C# ?5 X1 `. ~4 F
<div class="clearfix">
- _, b c; K7 K3 X9 G% d <button class="cancelbutton">Cancel</button>9 p6 Y7 j( M) W( `/ P% v. I
<button class="registerbutton">Register</button>+ ?' `4 r# S- L
</div>, g0 |7 B e) D
</div>
& W) U6 R }8 f4 a4 f6 K/ ?- l </form>0 S. \% Z( q# `4 w. u- F
</div>) {* t3 S% e' a# \- |
+ p. h# s5 k' B2 k7 g0 _- A. C4 G( S! R2 T8 ]' Y- d
. Z6 J: [! n$ [2 \
1 V- J! L- J' S- C3 k: y, H
9 ? w: m/ K# {" `, G
</body>5 E5 f- G. e) P$ g1 q
( V4 e0 r+ G$ x6 |</html>[/mw_shl_code]
* Z- T3 j. B9 j+ a( C8 Q5 M; o |
|