我可以同时使用flexbox和float吗?或使用flexbox与绝对定位? [英] can I use flexbox and float at the same time? or use flexbox with absolute positioning?

查看:1883
本文介绍了我可以同时使用flexbox和float吗?或使用flexbox与绝对定位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果我有一个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 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.

绝对定位的Flex儿童


flex容器
参与flex布局。但是,它确实参与了
重新排序步骤(请参阅 订单 ),它们的
绘画顺序有影响。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆