Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 7 months ago

Blog preview card

Mauricio Andrade•50
@mauricioandrade
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?

Fico feliz de conseguir começar a andar nos projetos, apesar de sentir que tem muita coisa diferente de muitos que eu vi, ainda sigo em frente e logo mais eu acabo refazendo e melhorando os que eu já fiz.

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

Ainda sigo com dificuldade em alinhas alguns itens no css, mas acho que é falta de olhar novamente sobre flexbox entre outras coisas, vou me dedicar mais para conseguir otimizar e melhorar isso.

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

sempre espero que alguém me diga as melhores formas de resolver os problemas, no caso me dar um norte para aquilo que eu fiz, e como eu poderia ter feito.

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Bernardo Poggioni•6,850
    @R3ygoski
    Posted 7 months ago

    Olá Maurício, parabéns pela conclusão do projeto.

    Bom, alguns dos usuários falaram como você pode resolver o problema que você estava tendo, então vou me concentrar na parte mais "teórico" do problema que você teve.

    Sobre o Flexbox, ele é utilizado sempre no elemento pai, vamos supor um HTML dessa forma:

    <div class="container">
      <div class="children">
      <div/>
    </div>
    

    Nesse caso, vamos supor que você queira alinhar o div.children no div.container, para fazer isso, você usaria uma display:flex no .container, e daí bastaria alinhar em cada eixo, que no caso seria align-items: center e justify-content: center. Note que também tem uma propriedade, que é a flex-direction, ela aceita 4 valores, mas vamos nos atentar a dois deles, row e column.

    Cada um deles muda a direção do alinhamento do Flex, e isso também altera os eixos de posição align-items e justify-content, pois antes o que era usado para alinhar verticalmente passa a alinhar horizontalmente.

    Como esse é um tema que pode ser um pouco grande, recomendo que veja alguns vídeos para poder pegar a ideia. Vou recomendar três vídeos que podem te ajudar.

    • Larrisa Kich - Flexbox
    • Serliv - Flexbox
    • Coding2Go - Flexbox

    E é isso, caso tenha ficado qualquer dúvida, por favor, sinta-se convidado a perguntar aqui. Tentarei ajudar da melhor forma possível.

    Marked as helpful
  • hitmorecode•7,540
    @hitmorecode
    Posted 7 months ago

    Congratulations it looks good. There are a few things for you to fix.

    • If you add flexbox on the body it will place the content in the center of the page.
    body {
        background-color: hsl(47, 88%, 63%);
        /* add these lines */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
    
    • If you add padding on the card, you don't have to add margin or padding on the elements to create space on the left and right side. Only use margin to create space on the next row.
    .cartao {
        width: 386px;
        height: 522px;
        background-color: hsl(0, 0%, 100%);
        display: flex;
        flex-direction: column;
        /* margin: auto; remove this line */
        /* margin-top: 200px; remove this line */
        border-radius: 20px;
        box-shadow: 7px 7px 1px rgb(0, 0, 0);
        /* add these lines */
        margin-bottom: 50px;
        padding: 20px;
    }
    
    • If you add flexbox on the body, you can remove this CSS rule.
    // you can remove this entire rule.
    /* .attribution {
        margin-top: 60px;
        margin-left: 730px;
        padding: 10px;
    } */
    
    

    I hope you find this helpful. Keep it up 👍👌

    Marked as helpful
  • Saul Gustavo A. S.•710
    @saul-gustavo
    Posted 7 months ago

    Hello, I saw your code, I understand what you did for this challenge, I solved this challenge by putting the following styles:

    body {
        background-color: hsl(47, 88%, 63%);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 100vh;
    }
    
    .cartao {
       width: 450px or 500px;
       padding: 2rem or 2em;
    }
    

    This centers all the content of the letter, and for the image you can use the display property: block;

    Happy Coding!! Good Job!!

    Marked as helpful

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
Frontend Mentor logo

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

Oops! 😬

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

Log in with GitHub