From ec04543775415c7ad9dda799f38298d3340d093c Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 12:27:52 +0200 Subject: [PATCH] Fix altezza immagini non costante in homepage --- index.php | 2 +- style.css | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index bf77aa9..dee1982 100644 --- a/index.php +++ b/index.php @@ -37,7 +37,7 @@ if ($result === false) {
fetch_assoc()): ?>
- Immagine prodotto +
Immagine prodotto

" . htmlspecialchars($row['ProductName']) . ""; ?>

diff --git a/style.css b/style.css index d51710d..575e933 100644 --- a/style.css +++ b/style.css @@ -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" */ } \ No newline at end of file