Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Request path contains unescaped characters
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

Responsive stat component card using sass

Fengβ€’ 280

@Feng-09

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Any tips or advice on how to shorten or more efficiently write my code will be highly appreciated.

Also, I have no idea why my screenshot looks like that, it looks just fine on my browser. Can anyone tell me why? And on my system, it doesn't load the font

Community feedback

Hassia Issahβ€’ 50,670

@Hassiai

Posted

Replace<div class="body">with the main tag and <div class="attribution"> with the footer tag to fix the accessibility issues. click here for more on web-accessibility and semantic html

To center .flex on the page using flexbox or grid instead of margin, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body.

USING FLEXBOX:
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
USING GRID:
body{
min-height: 100vh;
display: grid;
place-items: center;
}

For the color of the image wrap the img in a figure tag <figure><img></figure>. Give the figure a background-color of soft violet and give the img a width and height of 100%, object-fit: cover, mix-blend-mode: multiply and opacity: 0.8.

figure{
background-color: hsl();
}
img{
width: 100%;
height: 100%;
object-fit: cover;
mix-blend-mode: multiply;
opacity: 0.8;
}

In the media query, give the figure and article a width of 50%.

Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

1

Fengβ€’ 280

@Feng-09

Posted

@Hassiai Thank you so much. This was really helpful. I'll make sure I don't forget these. I still don't know why browsers don't read my font though, do you have an idea? On my phone, it works fine

0
Finneyβ€’ 3,030

@Finney06

Posted

Hello there πŸ‘‹. Good job on completing the challenge !

Here are some suggestions regarding your code that may be of interest to you.

HTML 🏷️:

To clear the Accessibility report:

  • Use HTML5 semantic elements such as <header>, <nav>, <main>, <aside>, and <footer> to define these sections.

  • Use ARIA landmarks such as <header role="banner"> and <footer role="contentinfo"> to provide additional information about the purpose of each section to assistive technologies.

Here is a web accessibility evaluation toolπŸ“• to check your webpage for any remaining errors or warnings related to landmarks.

I hope you find it helpful!😏 Above all, the solution you submitted is πŸ‘Œ. πŸŽ‰Happy coding!

Marked as helpful

1

Fengβ€’ 280

@Feng-09

Posted

@Finney06 Thank you so much. I understand now. I keep forgetting about the use of semantic tags, I'll remember next time

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