[英]How to change the default layout in CSS?
While rendering the images in the webpage, their layout doesn't follow the normal grid but the following one:在网页中渲染图像时,它们的布局不遵循普通网格,而是遵循以下网格:
Considering I have used Bootstrap as a framework, I applied a double class styling (note the child and parent classes) but it didn't change the alignment.考虑到我使用 Bootstrap 作为框架,我应用了双 class 样式(注意子类和父类),但它没有更改 alignment。 Is there a way I can align the cells so that each one of them occupies the same space and the layout is rectangular rather than pyramidal?
有没有办法可以对齐单元格,以便每个单元格占据相同的空间并且布局是矩形而不是金字塔形?
while ($row = mysqli_fetch_array($result)) {
?>
<div class="col-md-3 parent">
<form method="post" action="shporta.php?action=add&serial=<?php echo $row["Nr_Seri"]; ?>">
<div class="product child" >
<img src="img\\<?php echo $row["URL"]; ?>" class="img-responsive">
<h5 class="text-info"><?php echo $row["titulli"]; ?></h5>
<h5 class="text-danger"><?php echo $row["Cmimi"]; ?></h5>
<input type="text" name="quantity" class="form-control" value="1">
<input type="hidden" name="hidden_name" value="<?php echo $row["titulli"]; ?>">
<input type="hidden" name="hidden_price" value="<?php echo $row["Cmimi"]; ?>">
<input type="submit" name="add" style="margin-top: 5px;" class="btn btn-success"value="Shto ne Shporte">
</div>
</form>
</div>
.col-md-3.parent{
display: flex;
flex-wrap: wrap;
}
.product.child{
flex-grow: 1;
flex-basis: 25%;
}
I think you can change the display from flex to display grid.我认为您可以将显示从 flex 更改为显示网格。
.col-md-3.parent{
display: grid;
flex-wrap: wrap;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.