I have a Header
component as below
import React from 'react';
import styled from 'styled-components';
const Header = () => (
<div className={className}>
<div>LEFT</div>
<div className="progress-bar">CENTER</div>
<div>RIGHT</div>
</div>
);
const StyledHeader = styled(Header)`
display: flex;
justify-content: space-between;
align-items: center;
height: 4rem;
padding: 0 2rem;
`;
export default StyledHeader;
And below is the content of .progress-bar
.progress-bar {
background-color: green;
flex: 1;
justify-content: center;
align-items: center;
}
Initially CENTER was positioned center due to justify-content: space-between
defined at StyledHeader
, the problem was background-color: green
can only take very little space, so I proceed to define a CSS style, to make it flex: 1
in order to take as much space as possible, but I couldnt position it to be center
anymore?