Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

blog-preview-card-main using css and html

JosephSamuel-1•60
@JosephSamuel-1
A solution to the Blog preview card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

borders around the element

What challenges did you encounter, and how did you overcome them?

Aligning all text better

What specific areas of your project would you like help with?

Designing of the page more better

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Martin Fuentes•20
    @cmfc31
    Posted over 1 year ago

    1 - You should remove the media query @media (min-width: 1440px) from your code since makes the card align to the left side on bigger screens.

    2 - Instead adding the svg file code directly in your index you can just simple load the image from your assets folder using an img tag.

    <img class="blog-image" src="assets/images/illustration-article.svg" alt="Article image">
    

    3 - You should also implement the hover effect on the blog title and card drop shadow as an extra challenge. Also notice that in a mobile view the font sizes changes a little bit. To do this you can add a media query similiar to the one you try to use before. I usually set the mobile breakpoint in 640px.

    @media(max-width: 640px) {
      font-size: 12px;
    }
    

    4 - In your classes names avoid adding names that start with an upper case. Instead name your classes following the kebab-case convention.

  • Junier Bolívar 🕷•710
    @Junbol
    Posted over 1 year ago

    Hi Joseph! here are some recommendation for your project: PROS: Most of the features are there, it’s almost done.

    CONS:

    1. Card alignment to the left on desktops: 🐞 Solution: ✅ Basic structure semantics and the use of Flexbox : Start with body and main:
    /* Decorative styles */ /* Query for mobiles */
    html,
    body {
     margin: 0;
     padding: 0;
     margin-top: 0px;
     margin-bottom: 0px;
     height: 100vh; /* This ensures that the body takes the full viewport height */
     background-color: var(--color-yellow);
    }
    
    main {
     display: flex;
     justify-content: center; /* This centers the children of .mainContainer vertically along the main axis */
     align-items: center; /* This centers the children of .mainContainer horizontally along the cross axis */
     display: flex;
     flex-direction: column;
     height: 95vh; /* This ensures that the body takes the full viewport height.The only way to centered vertically is to use this on main */
    }
    

    Inside <main> you could add a <section class="card"> for your card

    Solution ✅The for the media querie for desktops you could delete it as Martin said it.

    1. README.md: Remember you have to use the README.md template and adjust it (using Markdown syntax) with your own details and links in GitHub there is still the original README file. Also would be good if you show your final screenshot.

    2. Screenshot: Your screenshot doesn’t match the original design, fix the alignment of the "Learning" title with the Date.

    3. Alignment:

    a. The alignment of some elements don’t follow the design brief given they are centered (unless you intended to do so) and they should be aligned left b. The card is not centered in the screen on desktop view: Reason:

    1. Footer: The footer need to be away from the Name and Photo of the presenter: You could add margin-bottom: 2rem

    2. SVG: I don't know if that was intetionally but you pulled off writing XML inside your HTML to add the svg file.

    RECOMMENDATIONS:

    1. **Semantic HTML: ** Try to use as much as you can semantic HTML in your index.html file this with readability , accessibility (AOM) (screen readers) (SEO). You could go here and check it out: (https://web.dev/learn/html/semantic-html) I went there again and I realized to add the ARIA ‘role’ attribute (in all my htmls 🤪

    2. **Flexbox: ** I’m sure you use 3wschools to refresh stuff. But these two new kids on the block are really great:

    3. [Flexbox] (https://web.dev/learn/css/flexbox)

    4. [Flexbox] (https://www.joshwcomeau.com/css/interactive-guide-to-flexbox/) Good look and Keep going!

    Cheers Junier

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub