css - Can't align p inside div with margin 0 auto -


i don't know going on can't align <p> inside div margin:0 auto; can't understand wrong or i'm missing, code:

<div class="test">     <p>text has centered</p> </div> 

this css

 .test   {      width: 100%;       margin: 0 auto;      max-width: 600px;      text-align:center;      background-color: #ececec;    }  .test p   {      display:inline-block;   } 

with this, text moved little bit on center of div it's not centered

 .test p {   text-align: center; } 

that's need.

if centering block element need margin:auto


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -