0

enter image description here

Sorry for the beginner question but i have been stuck on this for a long time. I have am trying to use flex to center align the div.Homepage elements but i cant seem to get anything but the button to align horizontally. I also cant get the text TEST to center. My CSS is below:

body {
    font-family: 'Recoleta';
    color: #FFF;
    background: #111;

}

html, body {
    height: 100%;

}

.Homepage{
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}

.logo-social-image{
    max-width: 20%;
}

My React HTML is below

   return(
            <div className="Homepage">
                <div className="Name-social">
                    {view}
                </div>
                <div className="Pro-button">
                    <OutlinedButtons  isLoading={this.state.isLoading} isLoaded={this.isLoaded} />
                </div>
            </div>
        )
Paulie_D
  • 107,962
  • 13
  • 142
  • 161
VickTree
  • 889
  • 11
  • 26

2 Answers2

1

Since you did not provide your HTML, I made an example of how to do it https://jsfiddle.net/L29h8oxs/

Add

  display: flex;
  align-items: center;
  justify-content: center;

To the parent div (I think it will be your .Homepage) and it should center the child for you.

Adam Buchanan Smith
  • 9,422
  • 5
  • 19
  • 39
0

Just add justify-content: center to the class Homepage.

.Homepage {
  /*Keep your previous style*/
  justify-content: center;
}
AdityaSrivast
  • 1,028
  • 1
  • 10
  • 16