Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Semantic HTML tag using, Sass, BEM className

#accessibility#sass/scss
Kai Liinβ€’ 40

@Beginneraboutlife116

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm not sure about my BEM announcement and my HTML usage. I really want to get some suggestions on it. If you could give me some advice, I will really appreciate you. πŸ™‚

Community feedback

Naveen Gumasteβ€’ 10,480

@NaveenGumaste

Posted

Hay ! Good Job Wei Kai

These below mentioned tricks will help you remove any Accessibility Issues

-> Add Main tag after body like it should be your container. For 1st heading or h1 tag, use header tag and then inside the header put your h1 or h2 etc . But use header tag only once in main heading element.

Keep up the good work!

Marked as helpful

2

Kai Liinβ€’ 40

@Beginneraboutlife116

Posted

@Crazimonk

Thank you for your feedback! πŸ‘πŸ» I realize that I always need a <main> tag after <body>. I just thought that the card is independent content, so I used the <article> tag on the outside at that moment.πŸ˜… Now I know how to fix that accessibility issues.πŸ€”

1
P
Graceβ€’ 27,950

@grace-snow

Posted

Hi

You’re definitely misunderstanding semantic html elements here. This is one piece of content. It can be a main element for the card or nest a div/article inside that if you want. Nothing else, and no aside needed

The figure element is not for wrapping all images. You only use figure when the content needs/ deserves a caption

The paragraph in the card is a paragraph not a h3

Every element that has a hover effect in a design means it is interactive. That means you must use interactive elements in these places. In this challenge that’s anchor tags wrapping the image, inside the heading, and wrapping the authors name. Essential.

I can’t see any of the interactivity (hover styles) because those elements are missing, but beyond that another styling issue is that the card is hitting all screen edges on my phone. It needs either a little margin around it, or some padding on it’s wrapper / body element

I hope this helps

Marked as helpful

1

Kai Liinβ€’ 40

@Beginneraboutlife116

Posted

@grace-snow Wow!! Thank you for your advice! I just thought that I was creating a card component, so I neglected the <main>. But just what you said, I should use <main> tag first, because it's still a piece of content. YESπŸ€” You helped me to clarify the definition of the <figure> element. Thank you a lot! I will fix it sooner. And about the anchor tag, I will put it into my challenge to make it interactive. Also, I will set the margin on my body element to resolve the issue that happened on your phone. Is it possible if I tag you and hope you could give me some advice again after I fix it? πŸ™‚

0
Michael Bishopβ€’ 1,070

@MikeBish13

Posted

Nice job on the solution!

Some feedback regarding your use of BEM and semantic HTML.

When using BEM, just be careful of the nesting of components. For example, in one section you have card__info-title and card__info-describe. Not only can this naming convention be confused for a modifier (--title, --describe) it can also get messy and complicated very quickly. See if you can create higher level components instead and then try and re-use them throughout the entire project, adding modifiers where needed. For example, these two components could easily have been changed to card__title and card__text. This article does a great job of explaining and solving some of the pitfalls of BEM - https://www.smashingmagazine.com/2016/06/battling-bem-extended-edition-common-problems-and-how-to-avoid-them/

As for semantic HTML, you've done a great job overall and this is a brilliant habit to get into. My advice would be to try not using a semantic element for the sake of it, and if in doubt always check the MDN docs for the full definition to see if it matches your intention. For example, I would argue that you don't really need <aside> in your article as the info in question is a crucial part of the card, rather than something indirectly related. Similarly, I would argue that <time> should be reserved for specific times or dates that could be supported by a datetime attribute, e.g 7 July, 20:00, 2h30m.

Hope that helps.

Marked as helpful

1

Kai Liinβ€’ 40

@Beginneraboutlife116

Posted

@MikeBish13 Thank you for your advice! All of these are useful to me, and also I find that I need to dive into the definition of BEM again when I review it from the document. The purpose of the BEM is to help us to create re-use components. The first time, I got into the BEM naming structure, I just thought it was really good for Sass, the nesting method. I just misunderstood that. It's so happy to have your advice. And also, I misunderstand the definition of <aside>, I would check the MDN again. Next time, I think I could use it properly. πŸ™‚

0
Maqsud Tolipovβ€’ 4,210

@maqsudtolipov

Posted

Hi there πŸ‘‹

Congratulate on finishing your project πŸŽ‰. You did a great job πŸ”¨

I give some suggestions that I hope help you take your project to the next level πŸ“ˆ.

  1. Let's fix the background color. It does not look like the original design. Use this color for background 0D1A2D
  2. And as Naveen said don't forget to fix accessibility issues πŸ‘

Happy coding β˜• Maqsud

Marked as helpful

1

Kai Liinβ€’ 40

@Beginneraboutlife116

Posted

@maqsudtolipov Thank you a lot for your color suggestion. I had confused when I was checking the background color at the time when I was doing this challenge. However, I just skipped about that🀣. Thank you~ And I will fix my issue by Naveen's suggestion. πŸ™‚

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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