引导网格环导致不同的高度

时间:2018-07-24 14:26:23

标签: php css wordpress

enter image description here我有一个自举网格循环,由于某种原因,结果的高度输出时错开了不同的高度?见图片。奇怪的是,在我的本地服务器上,它工作正常。也许与我的wordpress主题有些冲突?我已经尝试过多次添加屏幕截图,但是它不允许我这样做。如果有人发现此代码正在执行此操作的原因,请告诉我。

                   

<div class='container-fluid'>
    <div class='row'>
<?php
$host = "---------";
$username = "-------";
$password = "-----";
$db_name = "------";

$conn = mysqli_connect($host, $username, $password, $db_name);

if ($conn != true)
{
echo "No Connected!";
}


$category = $_POST['category'];
$location = $_POST['location'];
$cash = $_POST['cash'];

$sql = "select * from franchise where category like '%$category%' and location like '%$location%' and investment <= $cash";

$result = $conn->query($sql);
if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    echo "<div class='col-sm-4' style='padding: 15px;border-radius: 5px;'>"."<div style='border-style: solid; border-color: black; border-width: thin; padding: 15px; border-radius: 10px;'>".
          "<center><img src='".$row['image']."' width='200' height='200'><br>"."<a href='".$row['page_link']."'>".$row['name']."</a><br><p>"
          .$row['description']."</p><br><input style='width: 120px;
          height: 45px;
          background-color: orange;
          border-style: solid;
          border-color: red;
          border-width: thin;
          border-radius: 10px;
          color: white;' type='submit' value= '=> Request Info' ></center>
          </div>
          </div>";
    }
} else {
    echo "0 results";
}
$conn->close();

?>
</div>
 </div>

1 个答案:

答案 0 :(得分:0)

我认为您在px标记中忘记了<img>。 尝试<img src='".$row['image']."' width='200px' height='200px'

也可能是您的class='col-sm-4'与图像高度成比例。因此,请确保将所有图像转换为相同的高度。