Frage zur Verwendung von Overflow: Hidden zum Löschen von Floats
世界只因有你
世界只因有你 2017-05-16 13:36:43
0
1
863

Normalerweise kann das Festlegen von overflow:hidden; auf das übergeordnete Element des Floats den Float löschen. Ich habe jedoch festgestellt, dass das Festlegen von overflow:hidden auf den Body den Float nicht löschen kann Die Leute sagen, dass Body nicht zum gewöhnlichen Stream gehört, also ungültig ist. Kann es jemand erklären?

Vielen Dank:

CRIMXUm ein Wort von Wang Dalu zu leihen:

Menschen wie du sind entweder große Götter oder sie sind auf dem Weg, große Götter zu werden.

世界只因有你
世界只因有你

Antworte allen(1)
为情所困

这是因为并没有产生新的 BFC

产生新 BFC 的一个条件:

Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport).

为什么对 <body> 设置 overflow 会扩散到 viewport:

UAs must apply the 'overflow' property set on the root element to the viewport. When the root element is an HTML "HTML" element or an XHTML "html" element, and that element has an HTML "BODY" element or an XHTML "body" element as a child, user agents must instead apply the 'overflow' property from the first such child element to the viewport, if the value on the root element is 'visible'. The 'visible' value when used for the viewport must be interpreted as 'auto'. The element from which the value is propagated must have a used value for 'overflow' of 'visible'.

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!