"first of type" dont like to work:
.elements {
width:70%;
margin:0 auto;
display:flex;
flex-direction: column;
.addElement {
width:280px;
text-align: center;
border:1px solid black;
font-family: "Playwrite CO", cursive;
margin-bottom: 25px;
&:hover {
cursor: pointer;
}
}
&__newElement {
display: inline-block;
margin-top:10px;
margin-bottom:10px;
padding: 10px;
border:1px solid black;
font-family: "Playwrite CO", cursive;
&:first-of-type {
margin-top: 0 !important;
}
}
}
HTML:
<!DOCTYPE html>
<html lang="DE">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link Tree Clone</title>
<link rel="stylesheet" href="css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Playwrite+CO:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a8dfcfc0dce899989886869c">[email protected]</a>&display=swap" rel="stylesheet">
</head>
<body>
<main class="elements">
<div class="addElement"><p>Neuen Eintrag hinzufügen!</p></div>
</main>
<script src="javascript/main.js"></script>
</body>
</html>
i try to set the margin-top, of the first element which has the class"elements__newElement" to 0. Perhaps someone might have a clue...........................................................................................