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

Responsive Product preview card usig HTML and CSS

@nikolapetkovicdev

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I didn't encounter major difficulties with this task. If there are any areas where I could have improved or if I made any mistakes, kindly bring them to my attention. Thank you, and best of luck to everyone.

Community feedback

Daniel šŸ›øā€¢ 44,230

@danielmrz-dev

Posted

Hello @nikolapetkovicdev!

Your project looks great!

I have one suggestion for you to improve it even more:

  • Using margin is not the best option to center an element. Here's a very efficient (and better) way to place an element in the middle of the page both vertically and horizontally:

šŸ“Œ Apply this to the body (in order to work properly, don't use position or margins):

body {
    min-height: 100vh;
    display: flex;  /* it works with grid too  */
    justify-content: center;
    align-items: center;
}

I hope it helps!

Other than that, great job!

Marked as helpful

0
Petrit Nurediniā€¢ 2,860

@petritnuredini

Posted

First off, congratulations on completing your project! It's always a great accomplishment to turn a concept into a working product. Here are some best practices recommendations to enhance your project further.

HTML and CSS Best Practices:

  • Alt Text for Images: Great job using alt text for images! This is crucial for accessibility.
  • Semantic HTML: Use semantic HTML elements to improve the structure and readability of your web pages. For instance, consider using <main> for your main content or <header> for the top of your page.
  • Font Importing: You've imported the same font twice from Google Fonts. Make sure to import each font only once to optimize loading times.
  • CSS Efficiency:
    • Avoid redundant declarations, such as declaring font-size: 2rem; twice for h1.
    • Group common styles. If multiple selectors share the same properties, group them to reduce code repetition.

Responsiveness and Mobile-First Design:

  • Media Queries: Implementing responsive design is excellent. Consider adopting a mobile-first approach, where you start by styling for mobile and then add media queries for larger screens.
  • Units and Sizing: Ensure that units like percentages, em, or rem are used for responsive sizing instead of fixed units like pixels.

Performance:

  • Optimize Images: Make sure your images are optimized for the web to improve page load times, especially for users on slower internet connections.
  • Minimize HTTP Requests: Each @import statement in CSS creates an additional HTTP request. Consider downloading the fonts and serving them locally or combining multiple imports into one to reduce these requests.

Accessibility:

  • Color Contrast: Ensure sufficient contrast between your text and background colors for readability and accessibility.

Code Organization:

  • CSS Organization: Organize your CSS file by grouping related styles together and using comments to separate sections. This practice enhances readability and maintainability.

Learning Resources:

  • For understanding semantic HTML and accessibility, MDN Web Docs is a great resource.
  • To delve deeper into CSS best practices and responsive design, CSS-Tricks offers excellent guides and tips.
  • For performance optimization, particularly image optimization, check out Google's Web Fundamentals.

Keep up the fantastic work! Remember, every project is a learning journey, and you're doing great. Continuously applying best practices will not only enhance your current projects but also lay a strong foundation for your future as a developer. Keep pushing forward!

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