Blogger Information
Blog 16
fans 0
comment 0
visits 12543
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css元素定位
如花似玉的小牛牛的博客
Original
969 people have browsed it
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>相对定位/绝对定位</title>
    <link rel="stylesheet" href="dingwei.css">
    <style>
        body {
            background-image: url("http://www.d006.com/style/bg.jpg");
            algin:center;
            height: 1200px;
        }

    </style>
</head>
<body>
<div id="dingwei1">
<form method="get" action="http://www.d006.com">
    <link>账号:</link>
    <input type="username" id="username" required placeholder="请输入账号">
    <link>密码:</link>
    <input type="password" id="password" required placeholder="请输入密码">
    <button type="button">登录</button>
</form>
</div>
<div id="kefu">
</div>
<div id="youxia">
    <p>小葵花妈妈课堂开课了</p>
    <p>孩子不听话怎么办?</p>
    <p>多半是欠打了!</p>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

实例

div[id="dingwei1"] {
        width: 239px;
        height: 148px;

        text-align: center;
        border-radius:21px;
        background-color: #ff00a7;
        border: 1px red dashed;
        position: relative;
    top: 300px;
    left: 41%;
}

div[id="dingwei1"] form {

        position: absolute;
        top: 40px;
}
div[id="dingwei1"] form>input {
    height: 20px;
   border: 1px red solid;
}

div[id="dingwei1"] form>button {
    width: 88px;
    height: 38px;
    color: white;

    border: 0px;

    background-color: cyan;
    border-radius: 5px;
    position: relative;
    top: 10px;
}
div[id="dingwei1"] form>button:hover {
    background-color: black;

}
#kefu {

    width: 190px;
    height: 190px;
    background-image: url("https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1809927334,1828281527&fm=179&app=42&f=JPEG?w=56&h=56");
    background-repeat: no-repeat;
    position: sticky;
    left: 93%;
    top: 50%;
}

#youxia {
    width: 190px;
    height: 145px;
    background-color: #888888;
    text-align: center;
    position: fixed;
    top:76%;
    left: 85%;
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

笔记css定位分为 position:fixed粘性定位,position:relative相对定位,position:absolute绝对定位

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post