From 5b2c160de756c41fcb3898880b7475ce9a51c30d Mon Sep 17 00:00:00 2001 From: danielRedacted Date: Tue, 17 Sep 2024 16:42:46 -0700 Subject: [PATCH] fixing svg positioning --- card.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/card.html b/card.html index 3a44cd9..4426caf 100644 --- a/card.html +++ b/card.html @@ -154,14 +154,21 @@ color:lightgray; } .row .icon { - position:absolute; height:100%; aspect-ratio:1/1; top:0; left:-22px; border-radius:50%; background-color:#444 + position:absolute; + display:flex; + height:100%; + aspect-ratio:1/1; + top:0; left:-22px; + border-radius:50%; + background-color:#444; + padding:auto; } - - svg { + .row .icon svg { width: 50%; height: auto; fill:white; stroke: white; + margin:auto } @@ -221,17 +228,17 @@

Phone

const button = document.createElement('a'); button.href = contact.link; + const icon = document.createElement('div'); if (contact.icon) { // Fetch the SVG icon and insert it inline const svgContent = await fetchSVG(contact.icon); - const icon = document.createElement('div'); icon.innerHTML = svgContent; // Insert the SVG content icon.classList.add("icon"); icon.src = contact.icon; icon.alt = `${contact.contactType} icon`; - button.appendChild(icon); } - + button.appendChild(icon); + const name = document.createElement('h1') name.textContent = contact.contactType; button.appendChild(name);