-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 #3923
base: master
Are you sure you want to change the base?
add task solution #3923
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 |
---|---|---|
@@ -1,3 +1,66 @@ | ||
body { | ||
margin: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
|
||
$day-size: 100px; | ||
$gap: 1px; | ||
|
||
.calendar { | ||
max-width: calc($day-size * 7 + $gap * 6); | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: $gap; | ||
padding: 10px; | ||
&__day { | ||
background-color: #eee; | ||
position: relative; | ||
box-sizing: border-box; | ||
width: $day-size; | ||
height: $day-size; | ||
border: 1px solid black; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
&:hover { | ||
background-color: #ffbfcb; | ||
transform: translateY(-20px); | ||
cursor: pointer; | ||
transition-duration: 0.5s; | ||
} | ||
} | ||
} | ||
|
||
@for $i from 1 to 32 { | ||
.calendar :nth-child(#{$i}):after { | ||
content: '#{$i}'; | ||
font-family: Arial, Helvetica, sans-serif; | ||
font-size: 30px; | ||
} | ||
} | ||
|
||
$days: ( | ||
mon: 0, | ||
tue: 1, | ||
wed: 2, | ||
thu: 3, | ||
fri: 4, | ||
sat: 5, | ||
sun: 6, | ||
); | ||
|
||
@each $day, $index in $days { | ||
.calendar--start-day-#{$day} :first-child { | ||
margin-left: ($day-size + $gap) * $index; | ||
} | ||
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 selector |
||
} | ||
|
||
@for $i from 28 to 31 { | ||
.calendar--month-length-#{$i} :nth-child(n + #{$i + 1}) { | ||
display: none; | ||
} | ||
} |
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.
The selector
.calendar :nth-child(#{$i}):after
may not work as intended because the space before:nth-child
makes it a descendant combinator. This means it will select any element that is the nth child of its parent, not necessarily the direct children of.calendar
. Consider removing the space to target direct children.