This is a solution to the Four card feature section 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 for the site depending on their device's screen size
Preview:
My solution:
- Solution URL: Four Card Feature Section Repo
- Live Site URL: Four Card Feature Section Live
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- CSS Variables
There were many lessons learned. Positioning elements was certainly the most significant, but the ones listed below were also important:
1 - Merging rows in a CSS grid using span.
.card--1 {
grid-column: 1;
grid-row: 1 / span 2;
align-self: center;
}
2 - Using the data-icon attribute in HTML5 to reference an icon added to the layout via CSS.
<article class="card card--cyan card--1">
...
<p class="card__description" data-icon="supervisor">Monitors activity to identify project roadblocks</p>
</article>
.card__description[data-icon="supervisor"]::after {
content: "";
background-image: url('./../images/icon-supervisor.svg');
display: inline-block;
background-size: contain;
background-repeat: no-repeat;
width: 64px;
height: 64px;
position: absolute;
right: 3rem;
top: calc(55% + 0.5rem);
}
3 - Applying BEM modifiers to change the card's header colors.
.card--cyan {
border-top: 3px solid var(--co-Primary-cyan);
}
I definitely need more practice with positioning elements using CSS Grid.
The main resources I used were:
Complete Guide Grid - CSS Tricks
CSS Grid Layout Guia Completo - Origamid
- Website - Github
- Frontend Mentor - @lia-oliveira
- Twitter - @byliaoliveira