Design comparison
Solution retrospective
Hello š,
I am submitting another solution to the challenge. I deliberately chose a relatively simple one to focus on exploring more of CSS Reusability / Tailwind CSS capabilities for extensions.
Here is a bit of the breakdown. (More detailed explanation is available in the RespositoryURL).
What did you find difficult while building the project?
The project itself was relatively easy. However, one particular challenge took a bit more time than I expected - positioning the icon-music.svg
object into a card header.
I could easily add an image and text content element into a flex container, but it would require adding an explicit image tag/empty div element with an image background.
I thought it might be better to experiment with ::before
pseudoelement and avoid cluttering the HTML template with an extra element which could be avoidable.
Long story short, I followed my idea, and it worked well. It just took a bit longer than I expected.
Some general thoughts
I like this solution. I still strictly separate styling and HTML distinct, even when using Tailwind.
But compared to previous challenges, I focused more on reusability and extension, and I am happy with the outcome of using CSS variables with a combination of Tailwind extension capabilities.
In particular, I like how things like font-sizes could be extended:
// tailwind.config.js // the variables are defined in the style, // e.g: --text-size-small: 0.9375rem; /* 15px */ fontSize: { '2xs': ['var(--link-size-small)', { lineHeight: 'var(--link-line-small)', fontWeight: '500' }], 'xs': ['var(--text-size-tiny)', { lineHeight: 'var(--text-line-tiny)', fontWeight: '500' }], 'sm': ['var(--text-size-small)', { lineHeight: 'var(--text-line-small)', fontWeight: '500' }], 'base': ['var(--text-size-normal)', { lineHeight: 'var(--text-line-normal)', fontWeight: '500' }], 'lg': ['var(--heading-size-medium)', { lineHeight: 'var(--heading-line-medium)', fontWeight: '900' }], 'xl': ['var(--heading-size-large)', { lineHeight: 'var(--heading-line-large)', fontWeight: '900' }] },
It helped keep the CSS minimal and gave me enough confidence to apply this approach in future projects.
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there š. Congratulations on successfully completing the challenge! š
- I have other recommendations regarding your code that I believe will be of great interest to you.
DECORATIVE SVG'S āØļø:
- The
alt
attribute is used to provide alternative text for images in HTML documents. Thealt
attribute is used by screen readers to describe the image to visually impaired users, which is essential for web accessibility.
- Now, when it comes to decorative
SVGs
, they are used purely for aesthetic purposes and do not convey any important information or functionality to the user.
- Since these images do not convey any important information or functionality, there is no need for an
alt
attribute.
- So feel free to set the
alt
attribute as""
for decorativesvg's
, becausealt=""
will be skipped by screen readers they will consider the image as decoration
Example:
<img src="images/decorative.svg" alt="">
<img class="plan__icon" src="./icon-music.ad96ef5e.svg" alt="Music Note"> š <img class="plan__icon" src="./icon-music.ad96ef5e.svg" alt="">
.
I hope you find this helpful š Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord