This is a solution to the 3-column preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover states for interactive elements
- Solution URL: Click to see my solution working!
- Semantic HTML5 markup
- Sass
- Flexbox
This was my first time using Sass on a project, so basically, I learned Sass.
Here is some code that makes me proud of myself:
// _mixins.scss
@mixin responsive($size) {
@media(max-width: $size) {
@content
}
}
// _variables.scss
$cards-map: (
sedans: $bright-orange,
suvs: $dark-cyan,
luxury: $very-dark-cyan,
);
// _cards.scss
@each $class, $color in $cards-map {
.#{$class} {
background-color: $color;
@if $class == sedans {
border-radius: 10px 0 0 10px;
}
@if $class == luxury {
border-radius: 0 10px 10px 0;
}
@include responsive($mobile-size) {
@if $class == sedans {
border-radius: 10px 10px 0 0;
}
@if $class == luxury {
border-radius: 0 0 10px 10px;
}
}
a { color: $color; }
}
}
I will focus now on improving my Sass abilities and learn APIs.
- Sass official documentation - Official documentations will always be helpful.
- Frontend Mentor - @Paulo-Emerencio
- Digital Innovation One - @p_emerencio
Once again Kevin Powell helped me a lot with his sass videos on youtube.