与静态HTML相比,PHP生成的代码的页面样式更改[关闭]

I'm currently working on a product page with dynamically fitting divs for the products. Those work perfectly when testing straight with HTML code, but when the exact same code comes from the PHP script the CSS styling slightly changes, completly breacking the justify of the elements and packing them all togheter. The site is still under construction but the difference can be seen here:

White space is important .... see : http://jsfiddle.net/nh82yz5t/

You need to adjust your php so that a new line or white space character is inserted between the closing and opening cont_produto div tags.

That is, you want

<div class="cont_produto">
    <!--Stuff -->
</div>
<div class="cont_produto">
    <!-- Stuff -->
</div>

NOT

<div class="cont_produto">
    <!--Stuff -->
</div><div class="cont_produto">
    <!-- Stuff -->
</div>

The HTML rendered by your PHP script is most likely adding the DOM elements without line breaks/whitespace which is causing the "text-align" on the parent container not to work.

Here is an example using your sites CSS.

.produtos {
  text-align: justify;
  -ms-text-justify: distribute-all-lines;
  -webkit-text-justify: distribute-all-lines;
  text-justify: distribute-all-lines;
  overflow: auto;
  background-color: white;
  width: 80%;
  margin: 0 auto;
  padding-top: 20px;
  padding-right: 20px;
  padding-left: 20px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2) , 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.cont_produto {
    display: inline-block;
    *display: inline;
    min-width: 120px;
    width: 30%;
    max-width: 300px;
    margin: 0 auto;
        margin-bottom: 0px;
    background-color: rgb(187, 255, 255);
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2) , 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    margin-bottom: 20px;

}
<!-- With Line breaks -->

<div class="produtos">
  <div class="cont_produto">
    Some Image
  </div>
  <div class="cont_produto">
    Some Image
  </div>
  <div class="cont_produto">
    Some Image
  </div>
  <div class="cont_produto">
    Some Image
  </div>
</div>

<!-- No line breaks, most likely how your PHP is rendering -->

<div class="produtos"><div class="cont_produto">Some Image</div><div class="cont_produto">Some Image</div><div class="cont_produto">Some Image</div><div class="cont_produto">Some Image</div></div>

</div>