geekplux / geekplux.github.io

[Deprecation][PREVIOUS] My Website
https://geekplux.com
7 stars 2 forks source link

CSS 最核心的几个概念 | GeekPlux #25

Open geekplux opened 6 years ago

geekplux commented 6 years ago

http://geekplux.com/2014/04/25/several_core_concepts_of_css.html

SummerLiu95 commented 6 years ago

给博文赞一个,面试前复习看看挺好的

RayJune commented 6 years ago
  1. 元素设置 float 之后,脱离普通流(和 position: absolute; 一样)

觉得这里有一点小问题,float 后的元素会脱离普通流,但仍处于页面流中(正因如此会被 inline elements 识别并包裹);position: absolute 后的元素是彻底从页面流中删除。MDN https://developer.mozilla.org/en-US/docs/Web/CSS/float 和 CSS-TRICKS https://css-tricks.com/all-about-floats/ 均有相关的讲解。

摘一个 CSS-TRICKS 上的:

Floated elements remain a part of the flow of the web page. This is distinctly different than page elements that use absolute positioning. Absolutely positioned page elements are removed from the flow of the web page, like when the text box in the print layout was told to ignore the page wrap.

不过也是很早之前的文章了 :)

P.S. 博主的主题非常简洁、优雅,赞