当前位置:网站首页>Margin left: -100% understanding in the Grail layout
Margin left: -100% understanding in the Grail layout
2022-07-03 07:17:00 【darabiuz】
If not set margin-left:100% Words , that left and right Elements will be squeezed into the second line because of insufficient space
1. Yes margin Interpretation of values :
① Father son relationship :margin-left It refers to the left boundary between the child and the father ( If father has left padding value , It refers to this padding Line ) Distance of .margin-right It refers to the right boundary between the child and the father ( If father has right padding value , It refers to this padding Line ) Distance of .
② Brotherhood :margin-left It refers to my left boundary and my left brother's right boundary ( If brothers have right padding value , It refers to this padding Line ) Distance between .margin-right It refers to the distance between my right boundary and my right brother's left boundary ( If brothers have left padding value , It refers to this padding Line ).
The illustration :
2. about margin Understanding of taking negative values :
margin Negative values change the space occupied by elements . If you don't give him negative value , It must show on the second line , Because he occupies space .
This example ,left The width is 200px, When I set left Of margin-left by 200px, When it is the same width as him : That's what happens :
Obviously, we need to move more to the left , What is the distance of movement ?
center Width - left Width , That is, the distance marked in red in the figure below
We can conclude that : Just set up margin-left The negative value of is center The width of ( Initially moved 200px+ Distance to be moved ==center Width )
The second most intuitive understanding :
left The distance from the left of to the right of the parent element is equal to 200px
3. margin-left The meaning when the value of the attribute is a percentage :
When margin-left Percentage of value , Is the percentage relative to the width of the parent element
In the Grail layout, we set center The width is 100%, So the width of the parent element 100% Exactly equal to center Width , That's what we want
边栏推荐
- Basic knowledge about SQL database
- dataworks自定义函数开发环境搭建
- Advanced API (serialization & deserialization)
- 万卷书 - 价值投资者指南 [The Education of a Value Investor]
- Inno setup production and installation package
- 691. 立方体IV
- When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
- 3311. Longest arithmetic
- Selenium key knowledge explanation
- php安装composer
猜你喜欢
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
dataworks自定義函數開發環境搭建
Reading notes of "learn to ask questions"
C代码生产YUV420 planar格式文件
带你全流程,全方位的了解属于测试的软件事故
TCP cumulative acknowledgement and window value update
dataworks自定义函数开发环境搭建
[solved] unknown error 1146
Final, override, polymorphism, abstraction, interface
Arctic code vault contributor
随机推荐
Sorting, dichotomy
2021-07-18
JMeter JSON extractor extracts two parameters at the same time
MySQL syntax (basic)
mongodb
The essence of interview
4279. 笛卡尔树
mysql误删root账户导致无法登录
Laravel Web Framework
How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
Specified interval inversion in the linked list
【CMake】CMake链接SQLite库
[solved] unknown error 1146
Pat grade a real problem 1166
How to specify the execution order for multiple global exception handling classes
Common APIs
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
dataworks自定义函数开发环境搭建
Basic knowledge about SQL database