当前位置:网站首页>相对定位和绝对定位
相对定位和绝对定位
2022-07-29 05:10:00 【Try your best】
相对定位和绝对定位
除了基于“文档流”的定位,CSS还定义了标签的其他定位方式,CSS使用position属性指定标签的定位方式
position的值
static,默认值,即使用基于“文档流”的定位
relative,相对定位,即在“文档流”的基础上,结合left和top属性,相对定位
absolute,绝对定位,即脱离“文档流”,并基于它的“包含框”,使用left和top属性来定位
fixed,固定定位,即特殊的绝对定位,即它的“包含框”为浏览器
position:relative;(相对定位)
注意:
相对与原来的位置,使用left,right进行偏移
原来的位置对于后继元素的定位(float)依然有效
对于使用float的元素,realative也同样起作用
position:absolute;(绝对定位)
注意:
绝对定位脱离了”文档流“,
使用绝对定位时,注意找准”包含框“,即包含该标签,并且距它最近的,position不等于static的标签
如果没有,那么将以浏览器左上角为准来定位
特别
只定义position:absolute;没设置left和top,标签位置仍安“文档流”定位,但已经“脱离文档流”
边栏推荐
- [event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises
- Day 2
- Time complexity and space complexity
- 【C语言系列】— 字符串+部分转义字符详解+注释小技巧
- Integer overflow and printing
- paddle.fluild常量计算报错‘NoneType‘ object has no attribute ‘get_fetch_list‘
- 365 day challenge leetcode 1000 questions - day 037 elements and the maximum side length of squares less than or equal to the threshold + the number of subsequences that meet the conditions
- With cloud simulation platform, Shichuang technology supports the upgrading of "China smart manufacturing"
- ClickHouse学习(九)clickhouse整合mysql
- ClickHouse学习(四)SQL操作
猜你喜欢

Clickhouse learning (IV) SQL operation

数据库操作 Day 6

365 day challenge leetcode 1000 questions - day 042 array sequence number conversion + relative ranking discretization processing

365 day challenge leetcode 1000 questions - day 039 full binary tree inserter + find peak II + snapshot array

ClickHouse学习(五)集群操作

【C语言系列】—深度解剖数据在内存中的存储(一) 暑假开篇

Database operation day 6

【活动预告】云上数字工厂与中小企业数字化转型创新论坛

Day 2

Li Kou 994: rotten orange (BFS)
随机推荐
重定向和文件
D3d Shader Instruction
微信小程序视频上传组件直接上传至阿里云OSS
Day 2
Day 5
Day 5
刷题狂魔—LeetCode之剑指offer58 - II. 左旋转字符串 详解
365 day challenge leetcode1000 question - distance between bus stops on day 038 + time-based key value storage + array closest to the target value after transforming the array and + maximum value at t
阿里云架构师细说游戏行业九大趋势
浅谈Servlet
Day 2
实现简单的数据库查询(不完整)
用sql-client.sh生成的job在cancle过后 如何实现断点续传?
[C language series] - print prime numbers between 100 and 200
一维数组练习
Longest string without duplicate characters
C language one-dimensional array
数组学习之入门简单题 两数之和
paddle. Fluid constant calculation error 'nonetype' object has no attribute 'get_ fetch_ list‘
Using POI TL to insert multiple pictures and the same data of multiple rows of cells into the table cells of word template at one time, it is a functional component for automatic merging