html登录页面怎么做

html-css09

html登录页面怎么做,第1张

这是上课时老师演示的代码,只是前端的代码

<!DOCTYPE html>

<html>

<head>

<title>login.html</title>

<title>登录</title>

<link rel="stylesheet" type="text/css" href="./CSS/login.css">

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="this is my page">

<meta http-equiv="content-type" content="text/htmlcharset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

</head>

<body>

<div id="container">

<h1 id="title">小菊花爱心书店</h1>

<div id="information">

<form action="first.html">

<div id="box">

账号:<input type="text" name="keyName">

<br>

密码:<input type="password" name="userPass">

<br>

<input id="B" class="button1" type="submit" name="buyer" value="login">

<br>

<a href="register.html">立即注册</a>

</div>

</form>

</div>

</div>

</body>

</html>

------------------------------------------------

css文件

------------------------------------------------

@CHARSET "GB2312"

body{

background-image:url(../img/login.jpg)

background-size: cover

margin: 0

padding: 0

}

#container{

height:500px

width:400px

background-color:#D2B571

border-radius: 10px

margin: 100px auto

position:relative

box-shadow:2px 2px 10px #888888

}

h1{

text-align: center

padding-top:50px

color: white

}

#information{

background-color: #F5F4F2

height: 350px

width:400px

position:absolute

margin-top: 10px

}

#box{

width:200px

margin-left: 100px

margin-top: 60px

}

input{

display: block

width: 200px

padding-top:5px

height:35px

border: 1.5px solid #eee

border-radius:10px

background-color:#F4F8FF

}

.button1 {

height:35px

margin-top: 20px

padding: 5px 15px

text-align: center

background-color: #F48951

color: white

border: 0px

border-radius:10px

box-shadow:2px 2px 10px #888888

}

.button1:hover {

background-color: white

color: #F48951

border: 1.5px solid #F48951

}

button{

width:90px

position:absolute

top:70px

}

button:hover {

width:90px

position:absolute

top:62px

}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html charset=utf-8" />

<link rel="stylesheet" type="text/css" href="css/xing.css" />

  </head>  

  <body>  

  <div id="content" style="margin:0 auto background-color:#0F6 width:1000px height:500px position:relative">

  <div class="login" style="position:absolute top:50%left:50%margin-top:-100pxmargin-left:-200pxbackground:#69F width:400px height: 200px border-radius:10px">

      <div style=" margin-left:100pxmargin-top:50px">

        <p style="display:inline">用户名:</p>

            <input type="text" value="123"/>

      </div>

      <div style="margin-left:100pxmargin-top:20px">

        <p style="display:inline">密&nbsp码:</p>

            <input type="password" value="123"/>

      </div>

      <div style=" text-align:centermargin-top:20px">

        <input class="button" type="button" value="登录" style="margin-right:10px padding:5px 15px background:#F9C border-radius:3px border:#F0C 1px solid"/>

            <input class="button" type="button" value="重置" style="padding:5px 15px background:#F9C border-radius:3px border:#F0C 1px solid"/>

      </div>

     </div>

    </div>    

  </body>  

</html> 

整体居中,效果还可以。