【发布时间】:2019-11-13 11:46:23
【问题描述】:
尽管有很多flex 主题问题,但我找不到答案。
我创建了一个简单的 React 应用程序 (npx create-react-app)。
然后我删除了App.css并将index.css的内容设置为:
html, body, #root {
height: 100%;
margin: 0;
}
接下来,在App.js 中,我尝试使用 flex 实现全屏元素:
import React from 'react';
function App() {
return (
<div style={{ backgroundColor: 'blue', display: "flex", flex: 1 }}>
<div style={{ display: "flex", flexDirection: "column", flex: 1 }} />
</div>
);
}
但它只是行不通。为什么 flex 元素没有拉伸?
【问题讨论】:
标签: css reactjs flexbox css-in-js