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

NFT-preview-card-component-main

@Hakimullah92

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


  1. I build this challange using HTML-5 , CSS-3(Flexbox) 2.Difficulty in Image overlay

Community feedback

@0xabdulkhaliq

Posted

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.

HTML 🏷️:

  • This solution may cause accessibility errors due to lack of semantic markup, which causes lacking of landmark for a webpage and allows accessibility issues to screen readers, due to accessibility errors our website may not reach its intended audience, face legal consequences, and have poor search engine rankings, highlighting the importance of ensuring accessibility and avoiding errors.
  • What is meant by landmark ?, They used to define major sections of your page instead of relying on generic elements like <div> or <span>. They are use to provide a more precise detail of the structure of our webpage to the browser or screen readers
  • For example:
    • The <main> element should include all content directly related to the page's main idea, so there should only be one per page
    • The <footer> typically contains information about the author of the section, copyright data or links to related documents.
  • So resolve the issue by replacing the <div class="card-container"> element with the proper semantic element <main> in your index.html file to improve accessibility and organization of your page

.

I hope you find this helpful 😄 Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

0
Apah 280

@apah-dev

Posted

Hello!!!

Congrats 🎉 on finishing the challenge

There are a few things you should take note of moving forward.

The first one is semantics in html and accessibility

Using main as the first div for the body instead of div is better semantics for your code.

Using the h1 as the first header for your content is better semantics instead of the h3 that you used. You can adjust the font-size to fit the size you want.

Note: h1 should only be used once in a body

The next thing is the overlay that appears on hover. I think all you need to do is change the bg-color of the overlay div in your code.

Here's an example with my own code

HTML

        <div class="overlay">
          <img class="icon-view" src="images/icon-view.svg" alt="overlay" />
        </div>
      </div>

CSS

/*make the parent container position:relative*/
      .nftimagecontainer {
        position: relative;
      }
/*make the overlay div absolute to make it overlay on the main image container*/
       .overlay {
        position: absolute;
        background-color: hsla(178, 100%, 50%, 0.5);
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 10px;
        cursor: pointer;
      }

/* this is to position the icon in the center of the overlay */
      .icon-view {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
      }


      .overlay {
        display: none;
      }

      .nftimagecontainer:hover .overlay {
        display: block;
      }

In your code you could check background-color and opacity in the .overlay div class. Finally, check for unnecessary code that may not be doing anything to the position of the overlay and icon.

I hope this helps

Marked as helpful

0
Hassia Issah 50,670

@Hassiai

Posted

Replace div class="card-container"> with the main tag and <h3> with <h1> to make the content/page accessible.click here for more on web-accessibility and semantic html

Give the alt attribute in the img a value. The value of the alt attribute is the description of the image. For decorative images like icons, there is no need to give it an alt value, for more on alt attribute Click here.

Every html must have <h1> to make it accessible. Always begin the heading of the html with <h1> tag wrap the sub-heading of <h1> in <h2> tag, wrap the sub-heading of <h2> in <h3> this continues until <h6>, never skip a level of a heading.

For the overlay, give .card-img a width of 100% and position: relative, giver .card-img img a width of 100% and display: block, give .overlay position: absolute, right, left top and bottom of 0, background-color of cyan and opacity, give .overlay img position: absolute, top and left of 50%, transform: translate(-50%, -50%) and give img: hover .overlay opacity of 0.9 and cursor value of pointer.

.card-img{
width:100%;
position: relative;
}
 card_img img{
width:100%;
display: block
}
.overlay{
position: absolute;
top:0;
left:0;
bottom: 0;
right: 0;
background-color: hsl();
opacity: 0;
}
.overlay img{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

card_img img: hover .overlay{
opacity:0.9;
cursor: pointer
}

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

0

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