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

Frontend Mentor | Article preview component

@mukherjee-ayan

Desktop design screenshot for the Article preview component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I was not able to center the component vertically. If you have any suggestion regarding this or any other suggestions, please feel free to add it in the comment section. Thanks in advance.

Community feedback

Ivan 2,630

@isprutfromua

Posted

Hi there. You did a good job 😎

keep improving your programming skills🛠️

your solution looks great, however, if you want to improve it, you can follow these recommendation:

				**HTML**

Use HTML5 semantic elements. Make sure correct use of the HTML5 semantic elements like: header, footer, main, nav, article, section. It’s will help you to write more structured piece of code.

Set a meaningful img alt attribute. It’s best practice for SEO purpose.

<img src="images/drawers.jpg" alt="">
<img class="popover-fb" src="images/icon-facebook.svg" alt="">
<img class="popover-tweet" src="images/icon-twitter.svg" alt="">
<img class="popover-pint" src="images/icon-pinterest.svg" alt="">

Avoid complex wrapping. For better performance please tried to avoid unnecessary wrapping. It will create unnecessary node in your HTML tree and reduce performance too.

bad practice:
    <div class="image-drawer">
      <img src="images/drawers.jpg" alt="">
    </div>

Write Code Comments. It’s best practice to write human-readable code. Tried to comment your block of code. It will help you or any other developer to refactor the piece of code blocks.

				**CSS**

Use a CSS reset . By default, browsers don’t apply the same default styling to HTML elements, a CSS reset will ensure that all element have no particular style. For example: css-reset

Write consistent CSS. At the beginning part of the project you can set some rules for maintain throughout to your entire stylesheet. If you follow the convention or BEM, you’ll be able to write CSS without being afraid of side effects.

I hope my feedback will be helpful. You can mark it as useful if so 👍 it is not difficult for you, but I understand that my efforts have been appreciated

Good luck and fun coding 🤝⌨️

Marked as helpful

0
P

@GregLyons

Posted

I find centering an element vertically on the entire screen pretty tricky, since the

display: flex;
align-items: center;

method only centers it within the height of the element. If you were to apply these two rules to, say, the <body>, you wouldn't get the vertical centering since, if you inspect the <body>, you can see that its height is only that of the content (even though the entire background color changes). One solution could be to set the min-height of the <body> to 100vh (you generally don't want to explicitly set the height of an element, however, so we use min-height). This article goes a lot more in-depth on this. I've been reading the articles on that site and found them quite helpful!

Hope this helps.

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