Comments (2)
外边距重叠指的是,当两个垂直外边距相遇时,它们将形成一个外边距。合并后的外边距的高度等于两个发生合并的外边距的高度中的高度如果都是正边界,边界宽度是相邻边界宽度中最大的值。如果出现负边界,则在最大的正边界中减去绝对值最大的负边界。如果没有正边界,则从零中减去绝对值最大的负边界。
外边距重叠的好处:当我们上下排列一系列规则的块级元素时,那么块元素之间因为外边距重叠的存在,段落之间就不会产生双倍的距离,这样各处距离就一致了。就像p段落中,如果p段落中有多行,那么外边距重叠就能避免产生双倍行距。
如何清除外边距重叠:给一个元素设置display: inline-block就可以,
from fe-interview.
外边距重叠只在上下边距存在,左右不存在,两个在正常流中相邻(兄弟或父子关系)的块级元素的外边距会组合在一起成单边距,如果2个边距都是正数,取最大的那个,2个都是负数,取绝对值大的那个,一正一负取2个的和
from fe-interview.
Related Issues (20)
- 第63题:HTTP和HTTPS的区别? HOT 3
- 第64题:什么是同源策略,什么是跨域?解决跨域的方式有哪些? HOT 3
- 第65题:聊一聊强缓存和协商缓存呢? HOT 2
- 第66题:聊一聊XSS和CSRF呢?(网络安全) HOT 1
- 第67题:从URL输入到页面渲染发生了什么? HOT 1
- 第68题:数组里面有2w个元素,取第一个元素和最后一个元素的时间相差多少?
- 第69题:ES6 代码转成 ES5 代码的实现思路是什么?
- 第70题:promise-async笔试题,写出代码的运行结果, 并解释原因? HOT 2
- 第71题:Promise 构造函数是同步执行还是异步执行,那么 then 方法呢? HOT 3
- 第72题:介绍一下CDN,CDN回源策略是什么?
- 第73题:什么是Nginx负载均衡,常用的负载均衡算法有哪些?
- 第75题:清除浮动的方式? HOT 1
- 第76题:Vue2中,路由守卫有哪些? HOT 1
- 第77题:v-for 和 v-if 哪个优先级更高?如果同时出现,应如何优化? HOT 1
- 第78题:子组件可以直接修改父组件的数据吗? HOT 2
- 123 HOT 1
- flex 0 1 auto
- box HOT 1
- BFC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fe-interview.