内容简介:In CSS margin-collapsing refers to the fact that the margins that are next to each other are colliding… but only vertically.Yeah, it's one of thoseLet's first take two divs that are one next to each other on the horizontal axis. If we have a
In CSS margin-collapsing refers to the fact that the margins that are next to each other are colliding… but only vertically.
Yeah, it's one of those brainfuck moments in CSS.
Let's first take two divs that are one next to each other on the horizontal axis. If we have a margin: 25px
for both divs, and the width: 100px
then, as expected, the required width will be 300px.
However, if we try to do the same with the divs are arranged vertically then the total needed space will be 275px, instead of the expected 300px.
And this is because the vertical margins of the elements are collapsing.
But, what if the margins are of different sizes? What if one div has margin: 25px and the other has a margin: 40px? Well, in this case just the largest of the two margins will be applied (40px in our case).
And what about negative margins? The rule will be applied when both margins are negative (vertically), but not when one margin is negative and the other is positive.
If you want to learn more take you can a look at:
- What You Should Know About Collapsing Margins
- What's the Deal with Collapsible Margins?
- Good ol’ Margin Collapsing
I hope you have enjoyed this article and if you would like to get more articles about React and frontend development you can always sign up for my email list.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
微机原理与接口技术
李文英、李勤、刘星、宋蕴新 / 清华大学出版社 / 2001-9 / 26.00元
《高等院校计算机应用技术规划教材•应用型教材系列•微机原理与接口技术》是“高职高专计算机系列教材”之一。全书包括微机原理、汇编语言、接口技术三部分内容。微机原理部分讲述了80x86的内部结构及工作原理、半导体存储器及其系统、微型机总线结构等。汇编语言部分讲述了指令系统、编程技巧。接口技术部分讲述了中断系统、中断控制器、并行接口、串行接口、DMA控制器、定时器,以及A/D、D/A转换器等常用芯片的硬......一起来看看 《微机原理与接口技术》 这本书的介绍吧!
RGB转16进制工具
RGB HEX 互转工具
HSV CMYK 转换工具
HSV CMYK互换工具