Page 1 of 1

Wie kann ich einen Absatz erscheinen lassen, wenn es ein "Inhalt" -Element in den Stilen des Div enthält?

Posted: 01 Feb 2025, 09:04
by Anonymous
Ich erstelle eine Portfolio -Seite für meine Designs und stecke die Kreationen in mehrere Divs ein, die mit einer Funktion in JavaScript gemacht werden. Alle Bilder und Stile sind gemacht, aber es fehlt eine Sache. Ich habe ein Etikett für jede Kreation gemacht und möchte es, damit das Etikett vom Boden des Divs aufsieht, wenn ich darauf schwebe. Ich habe versucht,
zu verwenden, aber dies unterbricht das Element "Inhalt" im Div -Stil. Hier ist der Code: < /p>

Code: Select all

function newCreation(img, label) {
const creation = document.createElement("div");
creation.style.content = "url(Media/Creations/" + img; + ")"
document.getElementById("creationsCont").appendChild(creation);
}< /code>
#creationsCont {
width: 100%;
display: flex;
justify-content: center;
height: 250px;
flex-wrap: wrap;
}

#creationsCont div {
object-fit: contain;
padding: 5px;
width: 400px;
height: 250px;
margin-right: 10px;
margin-left: 10px;
border-radius: 15px;
margin-bottom: 10px;
border-color: #616161;
border-width: 2px;
border-style: solid;
box-sizing: border-box;
background-color: rgb(21, 12, 31);
flex-shrink: 0;
}< /code>