css - Giving inline-block divs margin -


i provided advice on how center align divs great im having issue divs stack on screen sizes should need give them margin no matter how margin give them changes anything?

html:

  <div class="categorylist">       <div class="categorypost">1</div>       <div class="categorypost">2</div>       <div class="categorypost">3</div>       <div class="categorypost">4</div>       <div class="categorypost">5</div>       <div class="categorypost">6</div>    </div> 

css :

.categorylist{     background-color: #fff;     height: auto;     padding: 0px;        text-align: center;     margin: 0 auto; }   .categorypost{     height: 200px;     background-color:red;     margin-bottom: 20px;     width: 300px;     display:inline-block;     margin:0 auto; } 

if understand correctly here example

html

<div class="categorylist">           <div class="categorypost">1</div>          <div class="categorypost">2</div>          <div class="categorypost">3</div>          <div class="categorypost">4</div>          <div class="categorypost">5</div>          <div class="categorypost">6</div>       </div> 

css

* {     margin: 0;     padding: 0; } .categorylist{     background-color: #ddd;     height: auto;     padding: 0px;        text-align: center;     margin: 0 auto;     width: 960px; }   .categorypost {     height: 200px;     background-color:red;     width: 300px;     display: block;     margin: 0 auto 20px; } 

demo


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -