2015-03-13 33 views
0

我试图在行中显示我的数据库项目,我无法继续前进与我的项目。我想这是从我的样式表,但我似乎并没有得到我的错误。我无法在行中显示我的数据库项目

我上传了一些图片,以便更好地理解我的问题。

http://imgur.com/v256LlC,ILUyBXe,fUthSOn#0

CSS:

#item { 

text-align:center; 
border: 5px solid #D9D9D9; 
height:10px; 
list-style: none; 
margin-left: 1.5em; 
margin-right: 30px; 
margin-bottom: 40px; 
margin-top: 40px; 
width: 140px; 
border-radius: 5px; 
-moz-border-radius: 10px; /* firefox rounded corners */ 
-webkit-border-radius: 10px; /* Safari rounded corners */ 
min-height: 200px; 
} 

#item li h1 { 
text-align:center; 
    } 

#item li#white{ 
min-height: 10px; 
} 

通过模型相呼应的产品:

<?php 

    include '../controller/produse.php'; 



    $products=Produse::SelectProducts(); 

    for ($key_Number = 0; $key_Number < count($products); $key_Number+=2) { 

    echo "<div id= 'item'>" . 

    "<p><img src=../".$products[$key_Number]." height=\"125\"width=\"110\" ></p>"; 

    echo $products[$key_Number+1]; 

    "</div>"; 
    } 

>

+1

请告诉我们你到目前为止 – 2015-03-13 09:37:31

+1

试过吗?发布你的代码可以帮助人们回答你的问题。 – 2015-03-13 09:38:05

+0

是不是可用的图片? – 2015-03-13 09:38:11

回答

1
<div style="display:table"> 
<div style="display:table-row"> 
<div style="display:table-cell">first cell</div></div> 

<div style="display:table-row"> 
<div style="display:table-cell">second cell</div></div> 

<div style="display:table-row"> 
<div style="display:table-cell">third cell</div></div> 

<div style="display:table-row"> 
<div style="display:table-cell">fourth cell</div></div> 

</div> 
+0

嗯,我有点想避免使用表,你更容易with'em。你有另外的建议吗? – 2015-03-13 10:42:20

+0

您可能想使用display:block; width:100%;与父母在每行 – 2015-03-13 10:49:55

+0

谢谢,我会尝试。 – 2015-03-13 12:08:06

相关问题