我可以同时使用flexbox和float吗?或使用flexbox与绝对定位? [英] can I use flexbox and float at the same time? or use flexbox with absolute positioning?
问题描述
例如,如果我有一个2列布局(主要内容和一个)我可以将主要左移,左侧/右侧,然后使用flexbox给出一个相等的高度相比主要内容?
for example if I have a 2 column layout (main content and a aside) Can I float the main to the left and aside to left/right and then use flexbox to give the aside an equal height compared to the main content?
我必须将整个容器显示到flexbox以包括标题,主要内容,旁边和页脚,或者我可以只挑一个区域使用flexbox? p>
Do I have to display the whole container to flexbox to include header,main content, aside, and footer or can I just cherry pick one area to use flexbox?
推荐答案
从概述,
Flex布局在表面上类似于块布局。它缺少许多
更复杂的以文本或文档为中心的属性,可以在块布局中使用
,例如 float
从 Flex容器,
float
和清除
对 flex项目,并且do
不会使它流出。但是,float
属性仍然可以
通过影响来影响框生成display
属性的
计算值。
float
andclear
have no effect on a flex item, and do not take it out-of-flow. However, thefloat
property can still affect box generation by influencing thedisplay
property’s computed value.
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.
这篇关于我可以同时使用flexbox和float吗?或使用flexbox与绝对定位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!