|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
一个简单的登录和注册HTML CSS开发页面
. {. D% }% }5 i1 N1 E( C
% E$ r! Q. e' @, o% n) \
2 l8 e- d1 ], B; R登录代码:
$ V5 Z# @- i8 x O% u4 v( ^" l' l" L- p' e/ X
[mw_shl_code=html,true]<html lang="en">
1 H+ L% q9 F) n& L% w, s, ~% L) {+ t5 e) t
<head>5 B+ V+ ]! R' o' o9 ?
<meta charset="UTF-8">
( J; g! c$ P& J( {8 R$ W <meta name="viewport" content="width=device-width, initial-scale=1.0">
* A3 K5 \1 q X: Z, ]* M9 C& G <meta http-equiv="X-UA-Compatible" content="ie=edge">& @ F Z3 E3 ^$ E1 \. o
<title>This is a login form</title>
- ?1 E( v2 W- R+ }, O, V4 N; C# `. ]. v. q1 O; X
<style>0 @" t/ [3 d3 b2 K7 n" p+ b
.modal {
+ s8 G3 Y* r8 C( g, L* G6 ~ display: none;
* l+ w; ~0 J+ A i8 l% J width: 100%;
( n" G! L# h: u) O' E4 ]4 Z8 ^ height: 100%;9 j, R9 J9 c3 G$ J
position: fixed;
7 i8 o0 E2 w5 o, \ h' z overflow: auto;
4 A+ B5 D& w; v) Y0 y( t# w% { z-index: 1;0 l6 @' j/ h5 T/ m) O) w
left: 0;) l" Q+ U4 T2 `9 \7 X) s
top: 0;. {! K$ Z8 \3 c8 S7 u4 W( Q9 Q8 R& I
background-color: rgb(0, 0, 0);
, A2 D+ |+ e5 j6 C8 C /* Fallback color */. q4 d* y% X' Q$ G: H0 ~
background-color: rgba(0, 0, 0, 0.4);! [7 V9 N2 \2 A( z$ N7 B
/* Black w/ opacity *// ^9 G5 U. N) R! z
padding-top: 60px;' }2 z& i( x; r0 l$ t
, R. D D5 @0 I' I6 F6 {. B0 ^& |
}
) W; B1 S9 K" t, l) `9 H- m3 a$ S$ R: Q) m2 y) ]: J D, k: [1 i
.modal-content {
+ Y! `$ J: ]9 d width: 60%;1 N; b5 f: w3 x% t$ V
background-color: #fefefe;
" p% `4 _* d8 L8 `* q& A1 P margin: 5% auto 15% auto;" H' `4 d3 O( S( D; ?# B/ H
border: 1px solid #888;
, z! h: s7 Q3 Y5 ]! z2 `
: j! a4 n) v% I$ S' B7 ?+ \7 h- F9 U }
$ ^6 j. _+ [1 o8 i/ f; @
' D1 q0 z- @$ x' [, j /* The Close Button (x) */
! `% a. ~ c8 H+ { .closeButton {2 Z6 o0 o$ c- Q* Y5 P0 r& F' t
position: absolute;, p5 L$ u1 |% ~7 i
right: 25px;
4 z) n4 z/ ]% _' @6 l% v- x' A top: 0;# |3 y7 z _) [$ X7 T$ I
color: #000;4 k" p: W" D/ \6 p7 h
font-size: 35px;
! D3 }- ~' z- E ] U3 w# `. Z font-weight: bold;+ H3 ^6 u$ V- c8 e3 n; [: z) n
}8 G$ ]7 p% M7 p& p
/ Q" _9 m& V$ C: k# v .cancelbutton {0 q7 q4 D% p5 D, A2 M5 P! G
width: auto;
. N1 }, v j6 d2 B- r padding: 10px 18px;$ P( k! M) H7 H0 [9 n0 k1 M4 G5 \
background-color: #f44336;8 z" }) v# B2 o8 F) H8 R( `2 G+ I/ b
}
* _8 W6 S; D: Z$ r' ?7 _& r& H) W6 a0 X
span.password {: e& R( _2 A- s5 w
float: right;- e! N( `* {) d% y5 Z% b( p; O% J k: k
padding-top: 16px;! h5 v; w* g8 \+ w# P
}
- V) ^, X- M0 w2 @8 t. r' U: u0 a. f7 M4 ~1 C" [& E
.closeButton:hover,9 S" q7 ~, c" s( U; _' I+ M4 w
.closeButton:focus {
; I$ B. b4 V/ d, ~, T9 z7 l% a4 r color: firebrick;
' p8 X* k& X7 F+ ], o1 E4 G cursor: pointer;) Q8 P/ Q8 t6 g- |) x
c) V G6 B7 w+ A
}
3 e/ Q& X) ]' c, U
. T* [- v% f7 P9 e* P .imgcontainer {
, V) r' K( d2 } text-align: center;
, a+ }3 z7 ]/ y, n6 H+ I9 U" X# P margin: 24px 0 12px 0;
+ [. m$ B& b% v position: relative;. h& z w$ _$ z! D+ M
}
2 K4 C( c6 E2 B0 e/ F9 v* I: K- ~! m' P/ v) Z9 Q! U
.avtar {
* ?8 _" [2 y4 v# B$ s/ A; W2 p( J* B6 ~ width: 40%;/ k1 W. l7 f; R2 M- Z* i
border-radius: 50%;
6 g/ Q7 Z" ]) b8 r7 ]8 s! [ }0 [2 U* D0 p7 r0 [
+ z. t$ F+ L4 e
.container {4 v. J' Z" b+ ], |5 t
padding: 16px;. O. p# \; i; _2 V8 i
}
" ^$ c: C8 l; h- l; p. v5 q4 e: r+ B, j
/* Full-width input fields */
: }' N5 ]3 T' m0 k' ~& E input[type=text]," W9 d. {* `1 r; R# U) p
input[type=password] {
5 V7 y2 J$ U( u' ~4 R width: 100%;* v2 Z! j9 o$ Z9 D+ P
padding: 12px 20px;
+ |, j O4 i9 ?# l6 y4 A; N margin: 8px 0;
/ G* |6 p X/ F8 n; ^ display: inline-block;
( ?5 v% e s4 p2 |& b0 Z border: 1px solid #ccc;. v7 y/ r' j0 L+ n, I8 L4 a
box-sizing: border-box;
R' P* Y5 x* I( k% k }
! O3 h5 y/ w. I
% n& k: l, k# Q S3 ?; z /* Set a style for all buttons */9 d7 u5 u1 ^9 D& t$ T3 l5 Y; f
button {
& ` p1 v, t- d, T/ F9 V% ? background-color: #4CAF50;
% b# v5 T0 {4 J& y C7 X! h& g color: white;. V$ `8 K+ I1 g$ ?9 H& m
padding: 14px 20px;
0 u1 ?& G* ?1 \# H6 b margin: 8px 0;% T$ {1 o1 p4 V1 O* K0 H$ x
border: none;/ k, v8 t3 L s6 C( V
cursor: pointer;
1 B% B" @2 Q f. p U6 n5 f width: 100%;/ @& |0 }' {( g4 b
}* ^. l& z" b1 [' Y- X
( Q, M. a6 q) e& }$ X
8 J5 }) Z/ W# h5 @4 K
button:hover {
, `2 b8 I: @- i; O9 p opacity: 0.8;
! z" f; o9 S4 u }
1 ]8 H4 c5 K* r/ a1 m" m" ~0 j* i X" G5 B% k
2 w1 s' T% B* h; ` /* Add Zoom Animation */! @, h& [7 |4 J3 W: W
.animate {* w* R# m& e) g7 v, S6 c
-webkit-animation: animatezoom 0.6s;
2 [% q ?) X9 k# O: o+ q animation: animatezoom 0.6s: u" T' |7 a# A
}
) m( }% H1 {) G0 K- `# L1 ~* G5 N# j; m g/ v& t
@-webkit-keyframes animatezoom { z6 D$ l# s- L0 k
from {! U' {( M; z, d" s
-webkit-transform: scale(0); t+ k! t& H$ ~$ Z; }
}
; Z7 k5 U* B. x( X% \0 @9 d- W0 L! @$ l9 ^* s
to {; Q5 H! n9 j+ h6 D6 t3 z
-webkit-transform: scale(1)
" i4 B5 k, {& z5 y9 v }: Y' w$ l( c/ F! z0 Q
}
0 }$ D& A+ A2 Q9 q( Z1 r
" `: \6 E2 ~% J+ g; _; }* C @keyframes animatezoom {2 t/ ]! T1 E! j: ^, I
from {
3 h& N7 s+ Q9 |2 K S' O9 r- Q2 } transform: scale(0)* Z& l( h) o. V4 B: o7 |
}) G# e: N. x1 q2 t) J
Z1 r, a9 y2 k
to {
: R# A$ [' U& b1 Q; x transform: scale(1)
4 x$ Z! Z! S( ^4 V, N+ W0 S/ H }& j2 ]) A9 k3 D4 \" G- a" v
}" U7 R4 A2 D" t
/* Change styles for span and cancel button on extra small screens */
0 U; H. c' h/ Y) d% D- b @media screen and (max-width: 300px) {
0 u7 b$ p- s9 G3 E4 m span.password {& K6 ?) a o0 F: Y; `
display: block;
" F! D! e+ {$ d+ u, ~/ ~: O float: none;% w1 f& d1 ^- L D
}
6 w4 p1 z9 q& Y/ u! g3 A* U# R
$ y' k% W( ~2 B* |1 k! c .cancelbutton {
9 _- g; w, O# @ width: 100%;
6 m8 O% H* i) z# H# k; u* @ R+ X }
' k) n, N2 Y& M& G" v+ ~ }
@2 E$ b/ h# }8 S: @" f3 u( t8 m </style>
7 E, P; i6 Y6 b+ ]</head>
4 z, R' B( P6 @$ r' L I, q
1 o0 Q' y1 J2 o) @ T# N/ Q<body>
9 Z6 h) f5 k" J# [0 `2 p
0 c% {; _1 w# L$ l' s- P <button id="login">login</button>+ m+ B4 N& ]$ @8 l% j3 [1 I
<button id="register">register</button>
. P' ^( Y( s2 j1 O0 _) @1 r9 O5 L
<div id="formPanel" class="modal">+ X& ]4 @1 D. D; N6 C/ H& G- @
<form action="./img/logo.png" class="modal-content animate">
1 N- ~( g4 Y { <!-- image --> s) b( b$ U% m' R6 i) m6 F+ b) O; P
<div class="imgcontainer">
$ P$ h- k: {3 n <span id="closeButton" class="closeButton"
L% E: j: N8 s! n, K9 n0 L- i: Z 1 d4 H% a& \$ f9 _& U; ~
title="close form">×</span>5 C6 L, A/ X @! k% [* W( f% o
<img src="./img/img_avatar.png" alt="avatar" class="avtar">: T3 b9 {# E! X6 i
</div>1 F% q Y1 |- t% Z( a
<!-- information -->! l, ]8 T4 O7 T% V6 O( w
<div class="container">
/ x% V; R' e: d1 h. X/ N# @( I$ L <label><b>UserName</b></label>
* B* L' t- f. d. e <input type="text" placeholder="username" class="username" required>
5 T- f+ ^; ^7 f <label><b>Password</b></label>3 ?& ^6 W6 u) t4 N) W' ?! a. `
<input type="password" placeholder="password" class="password" required>( p) [' i9 ~7 n4 y/ H$ L
<button class="loginButton">Login</button>
$ r7 h. E2 R4 S1 w w1 N$ ]1 A <input type="checkbox" checked>Remember Me
1 x8 S* P# e( w, G </div>
8 n9 l7 @" Q+ t, }4 N$ a" O' u% d# I; a- [! G1 B
<div class="container">
0 F2 q- ?, X/ V3 D4 \7 L( j <button class="cancelbutton" type="button" T, V. g+ R- `* d* _ D
>Cancel</button> z& i; B0 x0 M5 S, L/ \% H0 A
<span class="password">Forgot% b- R; q0 V0 G9 g
<a href="#">password?</a># j; V4 Z& j- W: f* U: n
</span>) D/ I# T" X+ O$ v, ^. q
</div>
! n& q5 ~# k0 p4 F1 ` </form>- n" C6 R$ T; U' B Z
</div>
8 D4 q# y& }( G8 q: k L4 n" i
3 J3 ?- Z) |( k6 m# l3 G0 O! e T3 t# V& }/ N) e
<script>8 X/ w8 w8 L$ x' D$ j
9 i4 t" T5 G4 |0 c* d* Q3 h2 T1 _/ Y, w
function loginForm() {7 N' }5 k, ]# ^& x+ n9 I
var formx = document.getElementById("formPanel")
$ h0 W0 X) r# o, y) h n3 x formx.style.display = "block"
- D3 d9 _# ~4 z! Z }
8 ?. c \7 K% R! b# U! {$ f8 U) r </script>4 {; A; r& ]2 g& y; x7 M8 o* [) l: y
! z. Y/ G/ I, L9 a" \
- ~( f+ C: |: Q ^4 \$ _ o</body>2 g/ F2 w5 @0 s( `" c
% Y6 y! e; g( j H. c7 L</html>[/mw_shl_code]# I @6 H1 ~- y- X. H N
! m: i# m! p8 I7 i
/ F" j% K% S) V9 k6 r注册代码$ p, G E0 b* [7 z
4 k, x/ o v" v8 k
[mw_shl_code=html,true]<html lang="en">
, a3 o% w% B' s# O- i
2 w# M" b# D1 J% `& {<head>
" T/ i' _; x! E% c- T <meta charset="UTF-8"># r2 g: K. r& h
<meta name="viewport" content="width=device-width, initial-scale=1.0">. q- \; E) T/ k
<meta http-equiv="X-UA-Compatible" content="ie=edge">
, f6 Y; A) l, N" b% _3 Q <title>register form</title>
& ~; j+ S1 E7 n' F' F* X
# Q4 t$ z2 ?8 }: `3 U <style>
- E! N, M% V6 X+ a8 e9 q( K .panel {
6 D/ V5 L; b& a2 ]5 y Q+ r width: 100%;3 C9 h( Z' U0 n& B' T. u
height: 100%;
6 t1 T- C8 ]6 l6 |! B background-color: rgb(0, 0, 0, 0.2);4 d' c9 b1 f4 l3 B8 e0 z6 L- i
padding-top: 30px;9 H( A+ I, c( i5 w& c9 u$ g
overflow: auto;" \8 }3 S1 K! {
position: fixed;) h' i$ b' _1 k- |) R3 ^3 f
left: 0;
! w6 j" U7 K7 F; f right: 0;4 X) F7 o( Z$ _; x3 @) V: O) g
z-index: 1;& U6 @. ~& w! N5 x7 }
}
4 ~) t& o* V/ ?" f7 [4 Y
|2 M3 a: Q! t" f0 u T# g% E .modal-content {% u' V7 c$ |: |, d
background: #fefefe;
( d: d' {+ u; v1 Y width: 60%;
- @2 s( W- V2 c' j a border: 1px solid #888;
$ k4 G7 f3 a5 y) X( g% [. | margin: 5% auto 25% auto;
+ {1 t4 _' H7 m
7 m+ v- [7 X9 O" ?. Z, s# \# e }* I c. S1 A2 T2 S
# W* B- f* T6 J
.container {
, W2 g6 \8 [$ M/ T: C$ [6 N padding: 16px;* l8 v7 b1 g: R h0 }. K1 T
}
: L, r6 _0 J8 C5 f# f. v, _
3 u4 b1 v' w9 A! m% r+ T9 y* f .close {& Z0 S; v( a% k6 M8 F" Q* Z* O! I
font-size: 40px;; }# J# Q# c7 Z1 ]( ^6 W
position: absolute;! Q; x! `! O9 U) y
top: 15px;) G m4 x8 z- s0 H2 M# X8 c8 P
right: 20px;
+ a5 x! V; q( H4 z }* y" r3 \0 q( @- Z; m4 |
8 y% d6 b. z9 Y" ]8 _7 l5 M .close:hover,: _ ^, M& W2 Q" n2 `$ K7 ^6 Q
.close:focus {( [1 o, A# ]0 ]9 T3 s# K
color: red;
1 h K- |5 s/ _+ `# w2 s8 M cursor: pointer;
$ t" k0 d: p) h4 f+ m3 r* } [1 I }
1 [; w7 e; s2 @( s" F/ J) a) y e9 c7 @
input[type=text],
7 Q" D+ U: e c# n9 _) s# n input[type=password] {
$ Y! {' v& y, V* H& S width: 100%;5 e" v/ L1 j* C
padding: 12px 20px;6 J+ I9 G, `& _0 J: [$ R
margin: 8px auto;6 Q+ V8 a5 d7 b* d( w p k7 _% h
border: 1px solid #cccccc;+ K" j7 h+ i4 I+ m
display: inline-block;. }' H5 `$ T5 O1 t
}* u' N8 Y% ^3 n( \* o
- j- [% S/ _. x8 j5 ^2 G
button {
+ U2 c" k! ]$ Q background-color: #4CAF50;# d% c& U* N5 _% J# ?+ S
color: white;; Q" g6 d* R) @& k4 _1 O+ s
padding: 14px 20px;
/ k6 I) W9 c# G; y margin: 8px 0;
# |. ]/ t3 m' w5 z border: none;0 I; \- D# H- i; q' G& c6 @/ Z
cursor: pointer;/ e/ B$ c' s& \, ^! }, a" W' I
width: 100%;' Q1 Q) b8 t$ k/ H& W% j$ W. _
}+ J: ^: A0 B9 D0 j. A. l
4 o3 s" n9 _* G* l# x" U( q" n# }: \
.cancelbutton {( ~& w- W1 o5 u$ M, ]( M& X9 S* {
padding: 14px 20px;
: M- R6 w5 c6 y* w# A0 P: ~ background-color: #f44336;7 w* A, M' u1 v7 B0 @) O: c/ H
}* u1 K, l7 b; o* S
% j- B" `+ u9 \7 E .cancelbutton,
" |: d; P$ \$ `' h8 @ .registerbutton {
* O# p/ E# j7 @1 Z: c: D float: left;
) z8 \1 o( } Y+ {% n& X$ K& f width: 50%% e, m2 V9 x' `. s, E8 J/ b
}8 y5 u$ L% Q$ Z' n [ l
6 T+ E4 n: i- }) A! |3 ^ .clearfix::after {
I8 k9 X: e E, _$ l5 k content: "";1 U6 O5 c; o% W) o8 }6 m: D& K
clear: both;9 X9 l, B A, C2 X+ s8 K0 U
display: table;
8 y! @$ c/ L6 f4 h1 y* d3 V! [& V3 ~ }
) d6 j4 R3 A- \6 c! X5 g/ S% g z' ~ </style>0 {2 v" P3 a' J+ {9 x2 O
/ Z4 ?' k5 e2 {- `( i
; R' K( k: `: U/ P) b, D, G
7 q, O' I' ]0 z. h, s6 P- ~' {4 g0 [
</head>; O4 b" ^+ W8 [/ G% P$ ?: x
Y9 V! \# v$ i0 _( O<body>
9 T/ v( z; Y# s, A; i4 F/ i) J- p# o5 T7 \3 B4 v1 B' u& o0 m% ]- V1 W/ l
<div id="modal" class="panel">
! X; F6 R' ^ ] <span class="close">x</span>
- P9 |# C0 f/ k3 y* ~2 {1 T1 @ <form action="#" class="modal-content">
7 E5 K1 `$ Z) L, v+ y. C0 U4 ` <div class="container">
' x! K& _& {, g7 v6 L) Y) \ <label>Email</label>' r! |* C; R$ {6 D" f' s
<input type="text" placeholder="Emmail" required>
8 H, X6 H+ d0 y <label>Username</label>
' s+ h& | J4 g2 g2 X <input type="text" placeholder="username" required>3 F6 C$ K5 w% ~5 X' L0 S$ O' u
<label>password</label>" j: o' G4 o ^9 C$ w `1 F
<input type="password" placeholder="password" required>- a1 S. E8 m6 d# z! d4 Y/ n$ J
<input type="checkbox" checked> remember me
0 Q, E0 h2 [! U- E$ b$ { <p>Follow the policy <a href="#">terms & privacy</a></p>- H+ F: O3 m) o9 h
4 Y" o5 `8 K4 M0 H! p
: m# r% \9 R+ U" g2 ~' X; N6 g <div class="clearfix">
S/ n* t$ Z- G% k( b9 h4 [. \7 e <button class="cancelbutton">Cancel</button>6 @# M0 \( D: I# K5 y# D
<button class="registerbutton">Register</button>
3 |2 Z' v8 A& N* W </div>
' L8 [! w* V. O# {& I# k; { </div>' A# }. R+ h A* M
</form>/ X7 t p1 ~- G; a* k D* \: i
</div>0 i8 k% @1 E% I' Y# I4 Q0 R$ P
9 ?# C: x ~$ b9 t, t
2 f9 h7 z4 h3 j- D9 Z! L% n. k0 [
8 t4 V P9 h k/ Z& v0 j; Z# B2 W- F! |1 `
* p6 _) H: M. U% d5 P7 C( z# q</body>
/ u- l y2 E! N) b
5 n& y p* k j( ]3 q; i! U8 G# u</html>[/mw_shl_code]. \! I5 ?% S( V1 X- | p' u5 [7 u
|
|