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

use flexbox

@iamkevin-sz

Desktop design screenshot for the Blog preview card coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


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

I am proud to complete the exercise, next time what I will do is always place the first container with a flex display, and also give it a margin, so the second container will have a width of 100%, doing this the margin will work for the first container , doing that took me time, another thing I will always do is start from mobile devices

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

The challenge I found was when I wanted to place the first p of a different size than the second p using p:first child and for the last p:last child, it just didn't work, I searched and couldn't find a solution, I don't know what it could be or Maybe I did it wrong, to overcome that what I did was put a classy span on it and thus be able to give a different style to each one

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

I would like help with the pseudo elements, since when I wanted to use p:firs-child it didn't work nor did p last child, I don't understand why, I wanted to use that so as not to put a span on each p and give it a class, but since it didn't work I had to give span to each p

Community feedback

Alexβ€’ 3,130

@Alex-Archer-I

Posted

Hi!

I can't see in your work any pseudo-classes or span elements, so I can't help with a specific example, but I can explain you a basic syntax.

Pseudo selector nth-child() can select one or more elements from the group of siblings. For example, you have an article.

<article>
    <p>Interesting Text</p>
    <p>Wise Text</p>
    <p>Boring Text</p>
</article>

And you want to save your readers from the boring part by making it painful to read.

p:nth-child(3) {
    color: magenta;
}

Now the <p>Boring Text</p> element is magneta. But keep in mind that this selector will look for every groups of siblings. So, in this case:

<article>
    <p>Interesting Text</p>
    <p>Wise Text</p>
    <p>Boring Text</p>
</article>

<article>
    <p>Fancy Text</p>
    <p>Cool Text</p>
    <p>Useful Text</p>
</article>

Both <p>Boring Text</p> and <p>Useful Text</p> will be bright magneta color.

Also as a parament for this selector you can use odd and even to select all corresponding elements.

There are also nth-last-child() selector which selects from the end, and first-child and last-child - more simplest versions.

Hope that helps =)

Marked as helpful

0

Alexβ€’ 3,130

@Alex-Archer-I

Posted

@iamkevin-sz

You're welcome. Alas, I can't tell why they didn't work in your project, so fell free to ask if you have some concrete example or anything else =)

Marked as helpful

1

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