批改状态:未批改
老师批语:
固定定位可以看做绝对定位的一种特例,相比与绝对定位寻找父级的位置,固定定位直接寻找最顶级的位置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>前端布局-固定定位实现小广告</title>
<!-- <link rel="stylesheet" href="staic/css/style03.css"> -->
<style>
body {
height: 2000px;
}
.guanggao {
position: fixed;
width: 450px;
height: 450px;
background-color: #ccc;
text-align: center;
right: 0px;
bottom: 0px;
}
h2 {
line-height: 450px;
}
.guanggao button {
float: right;
background-color: red;
}
</style>
</head>
<body>
<div class="guanggao">
<button onclick="this.parentNode.style.display = 'none'">关闭</button>
<h2>澳门赌场,线上招商</h2>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号