Hello, I just fininshed the typesetting task, here is the my code https://codepen.io/daisymzh/pen/zYRZqpg and here is the task page https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Typesetting_a_homepage , please let me know if I did the work correctly.
Also, here is one text styling task I didn’t work out, which is “Give the first paragraph after each heading in the <section>
a little bit of text-indentation”. In my code, I used a pseudo-class “section h2 p:first-child”, based on my understanding, p’s parent is h2, h2’s parent is section, p:first-child means the first paragraph after h2, so it confused me why it didn’t work. Thank you for taking time to read.
Hello @daisymzh95
you doing great well done here some notice :
- for the
section h2 p:first-child
mean section has h2 child who has p and target only the first sibling of those p but p is sibling of h2 not child of it
this the cheat sheet of css selector
so if we used section h2 + p
it will work cause that mean there section and has child h2 and p but we want to target the p that just next to h2 so we use h2 + p
hope that help and have a nice day
1 Like
Thanks for your explanation, I just noticed p and h2 are siblings, I should pay more attention to the html code.
1 Like
you welcome we all miss something sometime
1 Like