@shakhboz-shukhrat
Posted
Hello there👋! Congratulations on completing this challenge!
There are no major problems with the code, but there are some minor issues that need to be addressed for best practices and correct functionality:
It's recommended to use units when setting margins, such as margin-bottom: 10%; in the main selector.
The .hover selector has a height property with a value of 300px, but it's also overridden in the same selector with a height of 0px. The same selector also has an opacity property set to 0, which makes the element initially invisible. The height and opacity properties are animated on hover, which makes the .color element appear.
The .card-img:hover selector has a z-index property set to 12, which is a high value that may cause overlapping issues if other overlapping elements use values above 12.
The CSS declarations in the media queries could be grouped together to avoid repeating the same body font-size property.
Here's the revised code with these issues fixed:
body {
background-color: hsl(217, 54%, 11%);
color: white;
font-family: 'Outfit', sans-serif;
}
main {
display: flex;
justify-content: center;
align-items: center;
height: 90vh;
margin-bottom: 10vh;
}
.container {
width: 300px;
}
.flex {
display: flex;
justify-content: space-between;
margin: 3px;
}
.foot {
display: flex;
padding: 7px;
}
.card {
background-color: hsl(216, 50%, 16%);
padding: 20px;
border-radius: 15px;
width: 300px;
}
.hover {
position: relative;
height: 300px;
width: 100%;
}
.first {
color: hsl(178, 100%, 50%);
}
p,
.second span {
color: hsl(215, 51%, 70%);
font-size: 18px;
line-height: 2rem;
}
.foot img {
width: 50px;
margin-right: 5px;
border: 1px solid white;
border-radius: 50%;
}
.foot span {
padding-top: 20px;
color: white;
}
#line {
color: hsl(215, 32%, 27%);
}
h2 {
font-weight: 530;
}
.foot span:hover,
h2:hover {
cursor: pointer;
color: hsl(178, 100%, 50%);
}
.color {
background-color: hsla(178, 100%, 50%, 50%);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 0;
opacity: 0;
transition: ease-in-out;
}
.hover:hover .color {
height: 300px;
opacity: 1;
}
.color img {
margin: 42%;
}
.card-img:hover {
cursor: pointer;
z-index: 2;
}
.card-img {
width: 100%;
}
@media (max-width: 450px), (max-width: 375px) {
.container {
width: 80%;
margin: 10%;
}
body {
font-size: 0.8rem;
}
}
Anyway, your solution is great. Hope you will find this helpful. Happy coding!
Marked as helpful