|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
一个简单的登录和注册HTML CSS开发页面$ ] K( S) X- o+ ]0 g; o
" V" c. e, D$ \" m
) J$ |& E! O$ N5 ^( {2 R( }登录代码:+ Z# y! b6 Y+ |! ]
b) ?. Z1 B" S) L8 f, W5 p[mw_shl_code=html,true]<html lang="en">
- X' W9 m* s* {3 P, U! H1 `9 L `6 P2 C& w
: X$ s4 ]6 m5 l/ i6 n- W9 q$ S( Z/ K<head>
3 x2 z; H0 g+ Q3 b" o <meta charset="UTF-8">
9 M. h M/ G0 z <meta name="viewport" content="width=device-width, initial-scale=1.0">
: {$ w1 k5 D: c7 v. {0 k <meta http-equiv="X-UA-Compatible" content="ie=edge">2 p# v) G9 c& |$ q" |0 U. a
<title>This is a login form</title>
5 ~7 K2 w) e6 j1 o7 t5 }% { A
* x' m6 R) A. T% P* _8 T <style>
% o) M v$ ]4 k, G% d .modal {
; n( p6 M2 ?5 q: l1 N2 R+ g display: none;8 h: z r& j& \
width: 100%;; b, T' @. \4 r
height: 100%;9 w% D* O: Z$ r( X+ W# B& e
position: fixed;
1 m2 t2 {3 J" L2 R4 X overflow: auto;) f7 G9 g: U# C$ H4 q( z# S" A# V% }
z-index: 1;
* b* C6 S( N0 i9 ~+ y5 R7 R left: 0;
) ]( a2 Z- Z( Y top: 0;. L; a$ R& U3 Q$ Y4 x6 V
background-color: rgb(0, 0, 0);5 [$ u2 b5 L; ]- }8 m, G
/* Fallback color */
$ H# S: t# Z, X* u X background-color: rgba(0, 0, 0, 0.4);
1 d8 U ?& J# f2 V /* Black w/ opacity */0 ^0 P% U/ @+ r
padding-top: 60px;/ _& z2 V; _- c: e. f+ n
& ]% h& H* O8 ]# h
}) f3 x( }) j4 K! V" _: _8 H
0 [. F7 T0 r) }, D2 y# `" o .modal-content {
0 U+ S+ z2 d" R/ G* Y3 n. w g width: 60%;& l9 @' ]. o/ |. @6 u
background-color: #fefefe;
/ y, j6 c6 p- K, i* J9 \& c margin: 5% auto 15% auto;0 p9 Y" F+ D& w( G7 M& v
border: 1px solid #888;& K) ^: h7 d5 q" j
, L- q4 i+ L3 m' F9 @: {& s }
1 Q' h2 [4 d3 b
% G( [" S- y6 V/ \# G+ J /* The Close Button (x) */
0 P6 i4 W8 \. `* |' I .closeButton {
! _" g/ k5 G1 e0 } position: absolute;
( I, I& o7 S. x3 B; @: T0 P right: 25px;
8 R2 D7 }$ G" w/ N3 |8 j top: 0;
- N: r$ g- v% j6 z color: #000;
( v }3 J# j5 _ w( E font-size: 35px;
. x2 E% E$ W* S9 y% F3 } font-weight: bold;& E4 N" z+ p; ~: a3 |
}
* D1 o: V: s7 V6 a4 `) }$ ~+ B: d- h4 l! F
.cancelbutton {1 R, b5 g" u$ v+ a
width: auto;' p2 j: x# s, o2 z2 g
padding: 10px 18px;
1 H4 f9 e. _, a; O# Y9 D1 `# g% u background-color: #f44336;
. e# e( o6 A) e/ G }' a; M) Z' Q3 ^6 w% l8 w* M' n
- h E; ?! R. Z6 \6 Z span.password {
& t6 [$ [, P- Z7 b9 L* H float: right;
7 d: N1 P7 o5 ~) ` padding-top: 16px;
b/ a* \( Z4 G3 y7 V* ` }5 y+ o8 n$ Y% R7 J
. ^2 p' y# |. c& v6 q .closeButton:hover,
. k+ z) W; [! i5 Q- W+ G( H M .closeButton:focus {& V2 v5 q6 I/ r* o& C. d4 Y7 d L1 O
color: firebrick;
# Q: p/ ~* u$ B C/ L3 O4 y r cursor: pointer;
9 h; S2 B# i: q1 X8 u+ m- C! K: ? }# I8 Y
}
# x f/ O2 Q9 m! U7 f
9 g* N( c4 z1 f. R9 b+ n .imgcontainer {
' }0 R( l* M3 \) T1 N0 b: d text-align: center;$ N v3 S& o% E* O. e, @' N
margin: 24px 0 12px 0;
; F# v, Q2 X: j position: relative;
# q! d: o4 z' K }/ t w8 g2 l8 V/ z2 O2 C+ \& y0 ]& d4 A
' ] m3 s) O( R" ?4 P* U
.avtar {5 g& J, n# g. x% n7 `3 e d; s
width: 40%;
; P+ l& e6 C2 k. \ m+ E7 A border-radius: 50%; `7 d1 [7 |# Y9 C" F! N) r
}
6 K* g' Q9 |! J% O0 y5 s$ n s& g
.container {
5 r& J4 n o! h# v' j padding: 16px;
7 O. F- D. ]5 a9 H3 T: V$ X; u4 p( [ }
& f7 T4 G( m6 e3 g- s4 D1 u: I" v& R! d/ k9 k" ]7 w3 Y p8 z- U
/* Full-width input fields */
: i# Z' S! Y5 L0 T P. a input[type=text],' t! u+ M6 M& o! P. V% t& _
input[type=password] {
`( h) R; C! @ width: 100%;
. t% e% u6 @$ x1 k0 v padding: 12px 20px;/ J: }& M; G+ t/ Z: s
margin: 8px 0;
4 f2 l6 Y8 e! T: f8 h. L display: inline-block;2 f3 S4 b9 {5 C P9 a5 L) Y
border: 1px solid #ccc;* F# E' @$ t1 P2 l2 e4 l
box-sizing: border-box;; s( L1 }2 C9 Q( t: j$ ?
}
% M4 s2 \" {7 X
4 g4 t) I/ \) _2 t+ w8 S /* Set a style for all buttons */2 c) \! \4 X% G) n# b% ?
button {" t5 d+ U) y% p2 k* c
background-color: #4CAF50;+ n- b) [+ |5 j3 ]$ \/ {
color: white;! {; h+ F6 a) ~# y0 r; g; m
padding: 14px 20px;
. N- v! d' [7 B d2 X. y: n$ @ margin: 8px 0;0 r O( ~6 D) [3 I
border: none;
' h& v* |; F: `) W8 K! j cursor: pointer;
- k5 c! ?' _5 H0 Z4 u5 n' P width: 100%;- Y) v+ B2 L- w2 b
}3 [8 _) Y' N4 ]5 B/ q9 o+ n; ~: C
- b+ P3 C3 f$ P5 G2 `
4 }7 ]' G6 N: Y) M, y button:hover {" t1 C2 U( M: M/ p+ T! H
opacity: 0.8;
( U! K( C( r( k4 h9 G' m" o6 ` }) X9 _7 M- t* }
6 S; q" J) q* [2 } /* Add Zoom Animation */$ `/ v! X4 e( A5 C ] T
.animate {
* R* ^0 l8 B8 R3 @# o -webkit-animation: animatezoom 0.6s;
9 H, m9 c; k p. i9 B6 \ animation: animatezoom 0.6s
T. E5 ?) Y4 k0 ^# N }
$ F/ H6 e5 F& q! ~. G" n& M0 c% R: C8 r2 H6 M
@-webkit-keyframes animatezoom {3 P" K! _' D9 L, f) \2 y
from {
& ?, F, t0 M! b4 @4 O6 g* i+ o -webkit-transform: scale(0): I$ s; T' Z% U. ^) N
}; N0 n/ I3 Q, Y, u: A
; P y* A8 i9 h# Z# Z! _$ a1 Z1 ~ to {
4 C5 w9 x# @$ z1 U3 L* M -webkit-transform: scale(1)7 l4 \- v+ q- J; S! B
}
1 P; y( j" r4 ?1 @, m9 P, s }: |9 H2 Q, J- Z; E" h
R4 T+ G- h' v X9 R @keyframes animatezoom {
* \, Y( h: \9 e from {- o: r( `% ?: V
transform: scale(0)
, n2 H+ }0 g% Q }2 t% q, ^- q& P; q. ]
3 T. L' u ^* S5 e% n9 F to {
1 ~; G1 l; X2 N$ T3 k8 p: I transform: scale(1)
z7 v, ^$ b- w* k }% `( ]. k; c. L+ X
}- e) A( n/ Y }- Q2 L1 [5 h
/* Change styles for span and cancel button on extra small screens */
) t. Z: n# l. T% ]5 ]% ] @media screen and (max-width: 300px) {
: S$ T( {1 E k# X" ]2 F1 E7 K7 e span.password {
6 c- N& t! n2 H display: block;
v A/ }* r& q$ ] float: none;
! n+ Y+ g8 S# G9 v; k5 u8 {" b }
& `6 l# ~3 C3 V: ~, P' b( [
, d. G0 Z1 |) v+ z Y, e F .cancelbutton {- D# l# s9 q# x) k* p5 |$ K
width: 100%;# t4 L9 V4 B8 a
}
( ~1 J# U$ `/ d/ w4 p$ z0 S }: R5 F# l% z4 x
</style>% Z0 r5 \* d" u4 {- m1 @
</head>
* n6 S. }8 `3 M: S2 r6 F! S, k
( U, K; J n- Y3 m<body>+ C* O- a" S' D0 n; ^
5 x- E4 @/ q& ~; }7 q7 O! O" w. V
<button id="login">login</button>0 N w) R+ u! \6 b7 f
<button id="register">register</button>
q& y) r, R% B5 a6 l8 X6 p" H' `1 [1 [# }" r- B; l7 v
<div id="formPanel" class="modal">- a5 a% q, r8 H" C
<form action="./img/logo.png" class="modal-content animate">4 A% m v+ S) Z2 E
<!-- image -->
! }1 a' k+ a1 T' W0 c <div class="imgcontainer">3 B7 e/ T$ i3 m* g, h9 e
<span id="closeButton" class="closeButton"
# j, X2 k* v3 }3 O% H( L7 e $ X* U, y; h1 u# ?) n0 x
title="close form">×</span>- r% c% ^7 V! j5 Y
<img src="./img/img_avatar.png" alt="avatar" class="avtar">
( _" b9 K. ?3 o% C4 q* w4 H7 p; r </div>
0 B7 O# P8 Y) R7 {: U2 A; b <!-- information -->
4 T+ m4 ~$ T6 b0 H4 y <div class="container">
# t: E( V" X- F$ k <label><b>UserName</b></label>
+ \1 ], i( _( f <input type="text" placeholder="username" class="username" required>
) n @# J" y) |7 Q% v- Z <label><b>Password</b></label>1 j2 W+ o; J8 i0 N. Z
<input type="password" placeholder="password" class="password" required>
4 h: E; s; H7 d <button class="loginButton">Login</button>9 b/ M1 C1 P6 M6 C Q
<input type="checkbox" checked>Remember Me
2 q, d y+ P% d& r" L& y; z3 _. W </div>
; e6 B# E. p! @ _) O- P+ }1 L* t7 B# C' Y: Z4 N" v% }0 }8 C( X8 Z$ m5 z
<div class="container">
. D/ z( {: b8 l5 h3 p& j. X <button class="cancelbutton" type="button"
: f8 c, C, J1 y, G# k+ j d >Cancel</button>& o; ]3 P+ S+ O& G( F
<span class="password">Forgot: U; a1 j1 V9 f5 {: Q! w9 o1 h
<a href="#">password?</a>
2 G- V- F/ \0 `6 t </span>
( n2 G5 f4 L" b6 O8 u </div>6 Q7 g2 k6 b# d
</form>$ X O7 k8 S ?" d5 Q
</div>
: ?8 X3 g( @ u* x; }5 @
& t) x' i8 v0 H c) j. _( w6 c' s
<script>" G' g; V1 z3 ?9 ^
6 @' ~9 x8 ~" H& U" b+ M3 ] function loginForm() {
4 O" m) N5 }4 P( v0 B0 S( S var formx = document.getElementById("formPanel"), N* j/ u: @0 k% o4 c7 c9 }1 q
formx.style.display = "block"
8 M6 S+ h% U) ]% E7 \ }: [) j; i, c! p6 U7 |1 d( F
</script>* r G: X/ F6 v# q) \$ n, r
' e, |" X4 a& D
! K1 H% S' V; y</body>
& Z/ c+ K% w9 [9 W1 Z; `
3 L- ^. q7 A. }. J8 c+ z# v @; p</html>[/mw_shl_code]$ v1 A1 v2 s1 R
, F3 `! R- F8 }2 e3 S
3 x4 V4 D* N0 x7 C3 q
注册代码
9 H, A; ? \, A {% t2 f! A# A" W9 J0 p ?
[mw_shl_code=html,true]<html lang="en">4 Q. N$ l1 k5 z( u; k2 N
6 ]# N9 x5 r E1 q
<head>* C! P" k+ M7 h
<meta charset="UTF-8">
, g" ~1 A0 m; t. S' Q <meta name="viewport" content="width=device-width, initial-scale=1.0">
! y1 K" t) f& o: [ <meta http-equiv="X-UA-Compatible" content="ie=edge">
, X& Z6 m& x( M Y7 b0 ]) S. b1 I" q <title>register form</title>" U" |& y8 _( O, `- q5 W. M* f; ]
" v# o- s3 F- D' I
<style>/ ^- j( m6 p, ^! M# H: E
.panel {; F- E& Y3 r8 F9 t( N4 h
width: 100%;
1 @/ V' p8 t7 \# S height: 100%;
% r2 V3 P) X4 T' o$ J: `! }; u# M: o background-color: rgb(0, 0, 0, 0.2);
. Z' G0 ^* r4 Q3 g8 O# m& L padding-top: 30px;
" |; D; ^( T, v. _; @) U) K8 {0 D overflow: auto;
- v' j6 L- i% R; V position: fixed;5 N ?. [8 b# O( H& D8 H# g/ F
left: 0;
& n9 n# w. ^4 o8 X, j2 U right: 0;: { a5 ?9 W$ |' n# @
z-index: 1;6 {$ ]/ r' g m! Z
}
- M3 u9 }: M$ @" C3 H
7 k* a, s- k! C% N4 _ .modal-content {
+ H' M9 z( S \2 a background: #fefefe;
6 k: Z' Y, w3 r1 _( x width: 60%;
+ u8 W% }$ h1 W/ J border: 1px solid #888;
/ j4 d6 _+ t9 o1 E8 I; b9 j6 Q margin: 5% auto 25% auto;4 m2 e2 P, L9 v4 q% f2 W
/ B2 E: V, x6 ]$ ?6 c# q5 ^ }
0 ]" \- [1 E+ ]3 [
7 y# E/ }& R! \" ]: P# H9 ~ .container {0 S/ U2 W) B1 N0 F
padding: 16px;
! z6 M3 K0 R, z+ x% f }
' T" ~- B( y% Z( t) S
* m1 k5 ~1 I1 y; |5 B .close {3 C1 ?2 v9 O% V, z
font-size: 40px;! g$ M9 B, W+ n+ Y' t! ^! S, w
position: absolute;: M8 F, }2 |9 g4 X9 l
top: 15px;, X' I1 w# P1 b; n; }* Y2 N
right: 20px;6 l# D! m$ L; l
}
" X U# n) I5 a* Z3 C7 e2 |5 I* O$ B$ h$ h, W( i) P/ u
.close:hover,9 w1 N1 z( s% o) u0 C
.close:focus {
* K6 W+ ^0 Y9 { o, j6 R color: red;
4 w, g, |6 `+ V cursor: pointer;
5 ^" u- Q+ b; _. D7 D7 l }
5 a$ M: w3 B# H! q
3 I, c1 z' E! D; U' i input[type=text],0 q. i, Q$ f/ j! e; {: V' ?9 I c9 S
input[type=password] {
$ l( ]! i' t; ]3 _1 Z width: 100%;& S4 O. X9 ~4 o8 X
padding: 12px 20px;
. L! H% _! P3 n" A T margin: 8px auto; l. @' H0 j7 L6 \5 x! |" B+ G
border: 1px solid #cccccc;0 O8 B/ D- @. L
display: inline-block;$ E$ D7 R4 M, [$ Q* U
}
# u" t" N7 N1 X' J3 t T/ b$ }( k& a+ ^3 U
button {- A: o5 |" h* R, ?" a" ?
background-color: #4CAF50;
1 _, m |$ D; v, p color: white;+ G- H, O6 h2 v! v+ L
padding: 14px 20px;
! A! g6 [1 H4 [: V4 |* O1 o/ E2 N margin: 8px 0;6 }' S+ a* l% C1 T0 V0 m+ l
border: none;
+ ^! P# Y; }+ d& t. `5 N cursor: pointer;) \' }: T0 y5 v9 x
width: 100%;
2 x6 \; T: }' @6 q. R9 W }
0 X8 G! y0 R" K9 f1 i+ f0 @! V" N' \; G, Y
.cancelbutton {+ W5 D0 r) E" ^" w* ?% f2 N) G7 _
padding: 14px 20px;
P7 {9 O) _. @" W4 k8 D) H background-color: #f44336;
% t! a% ?# a; j' w( k4 w }
; _, G" t: D$ w! E3 ] ^2 ~" x9 U* [: l: I$ M
.cancelbutton,( @( W3 B7 {0 Y. H$ Z4 X# J
.registerbutton {2 t( _! \9 Y; ~4 q" a
float: left;4 E/ x, Y1 F& q* a* O. m
width: 50%; G& p* i" V; k4 G4 Q. m
}
0 v* `- ?' D. r4 J2 o
4 Z: e/ h( y; o9 x# q' s1 \; a; H( l- W .clearfix::after {# \4 Y3 r+ [+ D! l" i, c# x
content: "";/ n W: @1 e2 S; e2 H, u. L$ N7 c
clear: both;5 K$ v$ u" d, _$ X( w3 V a
display: table;
+ _3 Z. F2 r; l% w2 H' F }! g# \1 ]9 D/ v. w
</style>. t$ d* B5 K3 O5 ~. l& G) B- ]# v2 {
# a M$ C$ G( h6 Z# y8 I8 R, h* F; U4 e3 E/ H
8 E6 Z0 ]6 _8 ?7 y
</head>4 R) P! B, J; S: h" O) Y& _
* u8 s: @3 T% S7 a( h- m
<body> g# {+ C$ H+ P; F, W4 b' l
4 C/ V8 j0 _4 C3 K5 {( K; Y <div id="modal" class="panel">
- e, c5 O* g& }! J) F/ n7 ~/ h <span class="close">x</span># q& a0 l/ p+ k
<form action="#" class="modal-content">! T. j) t1 P( i- Q* W
<div class="container">) g0 R) t8 S" U9 Z4 Q
<label>Email</label>
% O# q* o d% ~: d8 w& [8 J <input type="text" placeholder="Emmail" required>- F# M' A) _. P& B
<label>Username</label>8 f3 a. q, I& t4 ?$ E/ t' ?
<input type="text" placeholder="username" required>- q% y( c* F3 d9 j, o
<label>password</label>
; U( Q# F. H7 ^6 t% h+ s& Y( Y3 a3 b <input type="password" placeholder="password" required>
' H9 d9 c* M4 {, j <input type="checkbox" checked> remember me$ X, ]4 C0 \% W* ?
<p>Follow the policy <a href="#">terms & privacy</a></p>' |2 t1 n* V3 m+ s* L' I: ^4 T; t# a
7 S* u" {- R* Y9 S1 t" e U
# n% X2 x) F9 b" m2 K <div class="clearfix">, B4 \& T8 w- ]8 C8 d9 n# _2 J
<button class="cancelbutton">Cancel</button>2 `0 N0 q: R; [! @0 V2 V3 q& d
<button class="registerbutton">Register</button>
m0 z' y7 W, l# P0 d. b" A( F </div>
' k, Y' V4 _7 g6 s </div>
. Q1 n: k+ o) X/ z" B </form>
9 |) @& s1 E' L </div>
8 @: Q4 J' H) E) K- |9 y0 a. q9 g( X5 F( K3 G
: z+ f& J$ H) Y, E% W
" o9 _+ ]4 x: r
5 t( z3 |; S, k* v2 b/ W
4 M! K1 n% w5 t: u4 g</body>
0 P9 o- O5 b# E! D% R# ?5 M
4 v% \3 Q$ s2 P# B</html>[/mw_shl_code]
& q: X" ~- @! @6 q. ] |
|