1 Star 0 Fork 0

白龙马 / HTML-CSS-JS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10CSS定位.html 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
白龙马 提交于 2024-02-23 08:28 . 第一次上传gitee十四
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>10 CSS 定位</title>
<style>
.box1{
height: 350px;
background-color: aqua;
}
.box-normal{
width: 100px;
height: 100px;
background-color: purple;
}
.box-relative{
width: 100px;
height: 100px;
background-color: pink;
position: relative; /* 相对定位 */
left: 120px;
top:40px;
}
.box2{
height: 350px;
background-color: yellowgreen;
margin-bottom: 200px;
}
.box-absolute{
width: 100px;
height: 100px;
background-color: darkorange;
position: absolute; /* 相对定位 */
left: 120px;
}
.box-fixed{
width: 100px;
height: 100px;
background-color: brown;
position: fixed; /* 固定定位 */
right: 0;
top: 300px;
}
</style>
</head>
<body>
<h1>10 CSS 定位</h1>
<h2>1.相对定位</h2>
<div class="box1">
<div class="box-normal">正常1</div>
<div class="box-relative">1相对</div>
<div class="box-normal">正常2</div>
</div>
<h2>2.绝对定位</h2>
<div class="box2">
<div class="box-normal">正常3</div>
<div class="box-absolute">2绝对</div>
<div class="box-normal">正常4</div>
</div>
<h2>3.固定定位</h2>
<div class="box-fixed">3固定
</div>
</body>
</html>
HTML
1
https://gitee.com/blma/html-css-js.git
git@gitee.com:blma/html-css-js.git
blma
html-css-js
HTML-CSS-JS
master

搜索帮助