html - 我可以同时使用 flexbox 和 float 吗?或者使用具有绝对定位的 flexbox?

标签 html css flexbox css-float

例如,如果我有一个 2 列布局(主要内容和旁边),我可以将主要内容向左浮动,向左/向右浮动,然后使用 flexbox 使旁边与主要内容具有相同的高度吗?

我是否必须将整个容器显示到 flexbox 以包括页眉、主要内容、旁边和页脚,或者我可以只挑选一个区域来使用 flexbox?

最佳答案

来自 Overview ,

Flex layout is superficially similar to block layout. It lacks many of the more complex text- or document-centric properties that can be used in block layout, such as floats

来自 Flex Containers ,

float and clear have no effect on a flex item, and do not take it out-of-flow. However, the float property can still affect box generation by influencing the display property’s computed value.

来自 Absolutely-Positioned Flex Children ,

An absolutely-positioned child of a flex container does not participate in flex layout. However, it does participate in the reordering step (see order), which has an effect in their painting order.

关于html - 我可以同时使用 flexbox 和 float 吗?或者使用具有绝对定位的 flexbox?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31953105/

相关文章:

CSS float 砌体

python - 使用 flask 在 html 页面中写入脚本的输出

javascript - 拖放获取可放置的多个图像的ID

javascript - 显示滚动区域外的元素

html - Flexbox - 等高图像列

css - 如何使输入组填充水平空间?

html - 防止 div 在浏览器屏幕缩小时移动

javascript - CSS 溢出 Marquee-Line 和 Floating Div

css - BootStrap DropMenu 不工作

javascript - 尝试通过 jQuery click() 单击外部链接来更改一个 div 的 css