0

my css so I can get the browser width and height:

body, html {
    margin:0;
    padding:0;
    line-height: 1.5em;
    height: 100% !important;
    width: 100% !important;
}

this is what I want its' children to center:

<div style={{marginLeft: 'auto', marginRight: 'auto', width: 'inherit', height: 'inherit'}}>
              <ul style={{listStyle: 'none'}}>      
                {this._renderTodos()}
              </ul>
              <Button primary onClick={()=>this._loadMore()}> Load More </Button>
            </div>

I wanted the parent div to inherit the browsers' width and height, I used margin left and right equal to auto, but it's not centering?

gpbaculio
  • 5,693
  • 13
  • 60
  • 102

2 Answers2

0

Change your CSS to:

body{
    margin: 0 auto;
}
koolkat
  • 706
  • 3
  • 8
  • 23
0

Your div is inheriting 100% width from your parent body element, then your ul block element is inheriting the 100% from the parent div.

Try adding a width to your ul and then it will center

ul{ width:50%; margin:0 auto; background:purple}
iSZ
  • 682
  • 5
  • 10