关于css元素的布局-设计一个登陆界面

.content{
    width: 1500px;
    height: 800px;
    margin: 0px;
    background: #FF99CC;
}
.content h1{
    font-size: 50px;
    padding-top: 200px;
    text-align: center;
    color: aquamarine;
}
.content form{
    margin: fill;
    padding: 1px;
}
.content form input{
    margin-left: 600px;
    border:1px ;
    width:300px;
    height:36px;
    display:block;
    border-radius:30px;
    text-align:center;
    margin-top:50px;
    font-size:24px;
}
.one{
    margin-left: 500px;
}
.content form button{
    background:#FC3;
    width:100px;
    height:36px;
    margin-top:50px;
    margin-left:100px;
    border-radius:30px;
}
.content form input:hover{
    background:#F99;
}

 

首先先定义一个大的主容器content的样式,然后在定义下面的元素,首先,在content下面定义了一个form,再在form下面定义其他的input样式以及button样式,因为输入账号密码框是上下相对的,我直接采用默认在div下面直接写,而两个button按钮是一个在左一个在右的,所以我采用了表格的样式,把他们两个设置在了同一行,两个button距离100px,此时,第一个button会离边框也是100px,所以我又定义了一个块级元素div,它的样式是one,离边框500px。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <link rel="stylesheet" href="register.css"/>
</head>
<body>
<div class="content">
    <h1>Welcome to use the library</h1>
    <hr/>
    <form>
        <div >
            <input type="text" placeholder="请输入账号" name=" "/>
            <input type="text" placeholder="请输入密码" name=" "/>
        </div>

        <div class="one">
            <table>
                <tr>
                    <td><button type="submit" >登录</button> </td>
                    <td><button type="submit" >注册</button>  </td>
                </tr>
            </table>

        </div>
    </form>
    <script>
        function signIn(){
            console.log("登录");
        }
        function register() {
            console.log("注册");

        }
    </script>
</div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值