tech snake tech snake - 1 year ago 37
React JSX Question

React and flexbox can any one look at this issue ? flex in flex gives an error

Hello as you ll see blue flex box is not flex any solution please


<script src=""></script>

<div id="container">
<!-- This element's contents will be replaced with your component. -->

JSX part it contains just 4 div

var Hello = React.createClass({
render: function() {
return <div className = "wrapper" >
< div className = "nav" >deneme < /div>
< div className = "main" >
<div className="dene">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam efficitur semper turpis, id mattis magna tempus nec. Nunc arcu justo, tristique ut tortor et, commodo elementum dui. Duis odio quam, placerat et justo scelerisque, egestas imperdiet ipsum. In at dolor elit. Mauris eu ex fermentum velit feugiat tempus. Curabitur nec turpis ac leo hendrerit rhoncus id eget ante. Ut vel ante vestibulum elit tempor dapibus. Curabitur vitae elementum magna. Ut ut pellentesque dui, eget aliquet mi. Phasellus tincidunt rhoncus urna et elementum. Fusce hendrerit viverra placerat. Vestibulum placerat fringilla ornare. Donec ligula ligula, fermentum et ipsum at, euismod imperdiet tellus. Donec non nibh magna. Cras eu elit et orci posuere pellentesque ac vel leo.</h1>
< /div> < /div>;

ReactDOM.render( < Hello / > ,

CSS document file there must be a problem here

body {
height: 100%;
margin: 0;


.wrapper {
display: flex;
flex-direction: column;

.nav {
background-color: red;
flex: 1

justify-content: center;
text-align: center;
align-items: center;
margin:auto 40%;

.main {
background-color: blue;
flex: 10;


Here is the result look at blue area

Answer Source

Change height to min-height in the container rule and it will grow with its content


Updated fiddle

When giving an element a height it will keep that height regardless its content, which will simply overflow the element when the content exceed the height, which was what happened in this case.

Using min-height will allow the element to grow along with its content, where the min- is short for be minimum this height

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download