mirror of
https://codeberg.org/ThisIsMiseryy/techstore
synced 2026-05-14 12:42:04 +00:00
Fix altezza immagini non costante in homepage
This commit is contained in:
@@ -37,7 +37,7 @@ if ($result === false) {
|
||||
<div class="products-grid">
|
||||
<?php while ($row = $result->fetch_assoc()): ?>
|
||||
<div class="product-card">
|
||||
<a href="product.php?id=<?php echo $row['ProductID']; ?>"><img src="img/<?php echo htmlspecialchars($row['ImagePath']); ?>" alt="Immagine prodotto"></a>
|
||||
<a href="product.php?id=<?php echo $row['ProductID']; ?>"><div class="img-square"><img src="img/<?php echo htmlspecialchars($row['ImagePath']); ?>" alt="Immagine prodotto"></div></a>
|
||||
<h3><?php echo "<a href='product.php?id=" . $row['ProductID'] . "'>" . htmlspecialchars($row['ProductName']) . "</a>"; ?></h3>
|
||||
<p><?php echo htmlspecialchars($row['Price']); ?>€</p>
|
||||
<button>Aggiungi al carrello</button>
|
||||
|
||||
@@ -123,4 +123,20 @@ form button:hover {
|
||||
margin-bottom: 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.img-square {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-top: 100%; /* crea un quadrato perfetto */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.img-square img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain; /* o "cover" */
|
||||
}
|
||||
Reference in New Issue
Block a user