Skip to content

Commit

Permalink
add solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mendes13 committed Nov 1, 2024
1 parent bfc531d commit a9cf40f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
43 changes: 42 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,47 @@
/>
</head>
<body>
<h1>Stars</h1>
<div class="stars stars--0">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<div class="stars stars--1">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<div class="stars stars--2">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<div class="stars stars--3">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<div class="stars stars--4">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<div class="stars stars--5">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
</body>
</html>
32 changes: 31 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
/* add styles here */
body {
margin: 0;
}

.stars {
display: flex;
position: relative;
text-align: center;
}

.stars__star {
width: 16px;
height: 16px;
margin-right: 4px;
background-image: url('./images/star.svg');
background-repeat: no-repeat;
background-position: center;
}

.stars__star:last-child {
margin-right: 0;
}

.stars--0 .stars__star:nth-child(-n + 0),
.stars--1 .stars__star:nth-child(-n + 1),
.stars--2 .stars__star:nth-child(-n + 2),
.stars--3 .stars__star:nth-child(-n + 3),
.stars--4 .stars__star:nth-child(-n + 4),
.stars--5 .stars__star:nth-child(-n + 5) {
background-image: url('./images/star-active.svg');
}

0 comments on commit a9cf40f

Please sign in to comment.