当前位置:网站首页>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
边栏推荐
- 691. 立方体IV
- II. D3.js draw a simple figure -- circle
- [solved] sqlexception: invalid value for getint() - 'Tian Peng‘
- The education of a value investor
- Advanced API (batch image Download & socket dialog)
- 多个全局异常处理类,怎么规定执行顺序
- Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
- gstreamer ffmpeg avdec解码数据流向分析
- Advanced API (multithreading)
- Advanced API (local simulation download file)
猜你喜欢
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
4279. Cartesian tree
"Baidu Cup" CTF game 2017 February, Web: blast-1
高并发内存池
dataworks自定義函數開發環境搭建
File operation serialization recursive copy
On the practice of performance optimization and stability guarantee
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Store WordPress media content on 4everland to complete decentralized storage
Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
随机推荐
Hash table, generic
[day15] introduce the features, advantages and disadvantages of promise, and how to implement it internally. Implement promise by hand
Deep learning parameter initialization (I) Xavier initialization with code
How to specify the execution order for multiple global exception handling classes
CentOS php7.3 installing redis extensions
Common APIs
2. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
Advanced API (character stream & net for beginners)
Basic knowledge about SQL database
Le Seigneur des anneaux: l'anneau du pouvoir
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Specified interval inversion in the linked list
Advanced API (multithreading 02)
New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
Wireshark software usage
php artisan
【最詳細】最新最全Redis面試大全(50道)
Advanced API (UDP connection & map set & collection set)
dataworks自定义函数开发环境搭建
TCP cumulative acknowledgement and window value update