W3C標準的算法里,float可能參與父級高度計算,但position:absolute;始終不參與父級計算。就是這樣設計的,沒轍:W3CCSS2.110.6.3規(guī)定了未創(chuàng)建BFC的非替換塊級元素的高度計算規(guī)則:Thissectionalsoappliestoblock-levelnon-replacedelementsinnormalflowwhen'overflow'doesnotcomputeto'visible'buthasbeenpropagatedtotheviewport.If'margin-top',or'margin-bottom'are'auto',theirusedvalueis0.If'height'is'auto',theheightdependsonwhethertheelementhasanyblock-levelchildrenandwhetherithaspaddingorborders:Theelement'sheightisthedistancefromitstopcontentedgetothefirstapplicableofthefollowing:thebottomedgeofthelastlinebox,iftheboxestablishesainlineformattingcontextwithoneormorelinesthebottomedgeofthebottom(possiblycollapsed)marginofitslastin-flowchild,ifthechild'sbottommargindoesnotcollapsewiththeelement'sbottommarginthebottomborderedgeofthelastin-flowchildwhosetopmargindoesn'tcollapsewiththeelement'sbottommarginzero,otherwise如上述分點,分項1定義了line-box撐高容器,分項2和3定義了常規(guī)流塊級元素撐高容器(margin折疊與否的兩種情況),否則為0。W3CCSS2.110.6.7規(guī)定了創(chuàng)建了BFC的元素(blockformattingcontextroots)的高度計算規(guī)則:Ifitonlyhasinline-levelchildren,theheightisthedistancebetweenthetopofthetopmostlineboxandthebottomofthebottommostlinebox.Ifithasblock-levelchildren,theheightisthedistancebetweenthetopmargin-edgeofthetopmostblock-levelchildboxandthebottommargin-edgeofthebottommostblock-levelchildbox.Absolutelypositionedchildrenareignored,andrelativelypositionedboxesareconsideredwithouttheiroffset.Notethatthechildboxmaybeananonymousblockbox.Inaddition,iftheelementhasanyfloatingdescendantswhosebottommarginedgeisbelowtheelement'sbottomcontentedge,thentheheightisincreasedtoincludethoseedges.Onlyfloatsthatparticipateinthisblockformattingcontextaretakenintoaccount,e.g.,floatsinsideabsolutelypositioneddescendantsorotherfloatsarenot.這里規(guī)則大致跟上方一樣,不同點在于margin不再折疊和float高度參與計算。總之呢,在“撐高父容器圈”里面沒有絕對定位元素的地位。