Blogger Information
Blog 20
fans 0
comment 0
visits 29383
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4.26号作业绝对定位/固定定位
蜗牛是条鱼
Original
909 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>0426作业</title>
    <!--<link rel="stylesheet" href="static/css/style8.css">-->
    <style>
        body {
            margin: 0;
            background-color: green;
            /*background-size: cover;*/
        }
        .shade {
            /* 遮罩绝对定位,并自动伸展到整个窗口 */
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;

            /* 将背景设置为纯黑,并通过透明度使背影内容透出来 */
            background-color: black;
            opacity: 0.7;
        }
        .login img {
            height: 460px;
            width: 380px;
        }
        .login {
            position: absolute;
            left: 50%;
            top: 50%;
            width: 200px;
            height: 300px;
            background-color: blanchedalmond;
            margin-left: -100px;
            margin-top: -150px;
            border-radius: 10%;
            color: red;
            line-height: 300px;
            text-align: center;
            box-shadow: 2px 2px 1px #888;
        }

        .ads{
            position: fixed;
            right: 0;
            bottom:0;
            background-color: blanchedalmond;
            border-radius: 30%;
        }
        button {
            position: absolute;
            top:0;
            right: 0;
            margin-right: 5px;
            background: none;
            border: none;
            font-size: 2em;
            color: red;
        }


    </style>
</head>
<body>
<div class="shade"></div>
<div class="login">请在这里登录</div>
<div class="ads">
<p>
    总结:<br>
    1.遮罩的使用,遮罩两个属性值注意 opacity 透明度; 设置一个背景色。<br>
    2.浮动窗口居中需要拉回去。<br>
    <button onclick="this.parentNode.style.display = 'none'">X</button>
</p>
</div>
</body>
</html>

运行实例 »

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


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!