Search code examples
jqueryhtmlcssmaterialize

Margin Auto renders to Margin 0px


I have the following css for a div :

#readWrite{
    width:100%;
    display: block !important;
    margin-left: auto;
    margin-right: auto;
}

But, when I open in Chrome, the margin renders to 0px and hence the div is not centered.

enter image description here

How to resolve this?

If I do putmargin's exact values, it works. But no Responsiveness, obviously.

Here's a jsfiddle : http://jsfiddle.net/7bp4m267/


Solution

  • Set your parent div

    #jam {text-align: center; width: 100%;}
    

    and your child div

    #readWrite {margin: 0 auto;}