-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add task solution #4942
base: master
Are you sure you want to change the base?
add task solution #4942
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,54 @@ | |
/> | ||
</head> | ||
<body> | ||
<h1>Stars</h1> | ||
<div class="container"> | ||
<div class="stars stars--0"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
Comment on lines
+17
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding some meaningful content inside these |
||
|
||
<div class="stars stars--1"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
|
||
<div class="stars stars--2"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
|
||
<div class="stars stars--3"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
|
||
<div class="stars stars--4"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
|
||
<div class="stars stars--5"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
Comment on lines
+17
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding some comments or labels to describe what these elements are for. It's not clear what the purpose of these |
||
</div> | ||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,144 @@ | ||
/* add styles here */ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use tag names for styling (except There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are using the '*' selector here. This can impact performance as this selector applies styles to every single element in the page. It's better to apply styles only to the elements that require them. |
||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.stars { | ||
display: flex; | ||
} | ||
|
||
.stars__star { | ||
width: 16px; | ||
height: 16px; | ||
margin-right: 4px; | ||
background-image: url(images/star.svg); | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
} | ||
|
||
.stars--1 .stars__star:nth-child(1) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
Comment on lines
+26
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are repeating styles for each '.stars--n .stars__star:nth-child(-n + n)' selector. This is not efficient. Try to avoid repeating styles as much as possible. You can create a common class for the active stars and apply the styles to this class instead. |
||
|
||
.stars--2 .stars__star:nth-child(1) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--2 .stars__star:nth-child(2) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--3 .stars__star:nth-child(1) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--3 .stars__star:nth-child(2) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--3 .stars__star:nth-child(3) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--4 .stars__star:nth-child(1) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--4 .stars__star:nth-child(2) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--4 .stars__star:nth-child(3) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--4 .stars__star:nth-child(4) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--5 .stars__star:nth-child(1) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--5 .stars__star:nth-child(2) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--5 .stars__star:nth-child(3) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--5 .stars__star:nth-child(4) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.stars--5 .stars__star:nth-child(5) { | ||
margin-right: 4px; | ||
width: 16px; | ||
height: 16px; | ||
background-image: url(images/star-active.svg); | ||
background-repeat: no-repeat; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The styles for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use semantic tags where possible. For example, instead of using a
div
with classcontainer
, you could use asection
ormain
tag. This will improve your page SEO and help screen readers. Remember,div
does not have any meaning.