flexbox项目上的宽度被忽略 [英] Width ignored on flexbox items

查看:54
本文介绍了flexbox项目上的宽度被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://jsfiddle.net/XW9Se/

我将 width:200px; 设置在左侧的< div> 上,但是如果我查看的话使用浏览器检查器工具,实际宽度似乎是随机的或某种程度。

I've set width: 200px; on the left <div> but if I view it with the browser inspector tool it appears that the real width is random or something. It keeps changing depending on the window size.

为什么宽度不生效?

>编辑:如果我删除 width:100%,宽度保持固定。但是我需要这样,以便 #main div占用剩余的宽度:(有什么方法可以使侧边栏@固定宽度,而其他< div> 填充其余的容器宽度吗? width:auto; #main 上的不起作用。.

EDIT: If I remove width: 100% the width stays fixed. But I need that so the #main div takes the remaining width :( Is there any way to have the sidebar @ fixed width and the other <div> fill the rest of the container width? width: auto; on #main doesn't work..

推荐答案

删除 .container> div 并使用 flex:auto; #main 上:小提琴

#main {
   flex: auto; 
   background: lightblue; 
  -webkit-order: 2;
   order: 2;     
}

这篇关于flexbox项目上的宽度被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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