当前位置:网站首页>Correlation analysis of position attribute value
Correlation analysis of position attribute value
2022-07-22 06:21:00 【Dummerd】
position The property values for are :
1. absolute: Absolute positioning , Is relative to the nearest and not static Locate the parent element of the ( Will break away from the document stream )
2. fixed: Absolute positioning , Is positioned relative to the browser window , Is constant , Won't scroll with the screen .( Will break away from the document stream )
3. relative: Relative positioning , Is positioned relative to its original position .( Does not break away from the document stream )
4. static: The default value is , No location .
5. Inherit: Inheriting from the parent element position value .
First of all to see position: relative Relative positioning
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>position</title>
<style>
div {
height: 50px;
width: 50px;
}
.div1 {
background-color: red;
}
.div2 {
background-color: green;
}
.div3 {
background-color: blue;
}
</style>
</head>
<body>
<div class="div1">div1</div>
<div class="div2">div2</div>
<div class="div3">div3</div>
</body>
</html>
Now we're right div2 Use relative positioning , Add style position: relative;( Relative positioning )
top: 22px;left: 33px;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>position</title>
<style>
div {
height: 50px;
width: 50px;
}
.div1 {
background-color: red;
}
.div2 {
background-color: green;
position: relative;
top: 22px;
left: 33px;
}
.div3 {
background-color: blue;
}
</style>
</head>
<body>
<div class="div1">div1</div>
<div class="div2">div2</div>
<div class="div3">div3</div>
</body>
</html>
position: absolute Absolute positioning (! Note that this will break away from the document flow )
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Absolute positioning </title>
<style>
#div {
width: 300px;
height: 300px;
background-color: blueviolet;
position: absolute;
left: 110px;
top: 110px;
}
</style>
</head>
<body>
<div id="div"></div>
</body>
</html>
At this time, set the distance from the top after positioning 110px, From the left 110px
It is worth mentioning that after the element is set to absolute positioning , His original position will be occupied by other elements , It's also called breaking away from the document stream
边栏推荐
- 关于面试的一些问题
- Goldfish rhca memoirs: cl210 Integrated Identity Management - project organization management + chapter experiment
- 水平布局,垂直布局,阴影和圆角
- 安装与卸载MySQL的详细步骤
- leetcode1588.所有奇数长度子数组的和
- Compound modified chitosan hydrogel: preparation of acrylic acid grafting / polyvinyl alcohol / temperature sensitive icariin / aldehyde imine chitosan hydrogel
- Leetode 416. Divide equal sum subsets
- 在Cygwin环境下构建和使用EmberZNet PRO Zigbee Host应用程序
- 剑指 Offer II 100. 三角形中最小路径之和
- Exploration of running applet of domestic Tongxin UOS system
猜你喜欢
LeetCode刷题:平衡二叉树与翻转二叉树
Haproxy2.6 load installation configuration
Preparation of chitosan / dextran / nano hydroxyapatite composite hydrogel / fish gelatin galactose chitosan hydrogel liver scaffold
第1集 vmware虚拟机安装最牛B教程(12天)
使用Lingo求解简单的线性规划问题
haproxy2.6负载安装配置
Building and using the embedznet Pro ZigBee host application in the cygwin environment
Development of digital collection system -- Construction of mall blind box H5 platform
leetcode 1306.跳跃游戏 III
AUTOCAD——JOIN合并命令
随机推荐
leetcode 310. 最小高度树
leetcode1588.所有奇数长度子数组的和
Control of semiconductor refrigeration and heating based on general single chip microcomputer control of cold and hot head in mobile phone radiator massage instrument
Idea setup and environment variables
LeetCode刷题:位运算(找不同 和 只出现一次的数字)
Some tool modifications
NETCORE - Middleware (1)
技术团队:给代码评审发起者的4个建议
第1集 vmware虛擬機安裝最牛B教程(12天)
Sword finger offer II 015 All modifiers in the string
leetcode 1582. Special position in binary matrix
同城订单同城送,爆单依旧得心应手!
Position属性值的相关解析
关于面试的问题2
使用Lingo求解简单的线性规划问题
leetcode 1582. 二进制矩阵中的特殊位置
室外资源光纤管理
Western Agricultural University C plus
Automatic generation of computer room visual management labels
64. Minimum path and