Responsive Blog Preview Card - HTML CSS

Solution retrospective
I tried to make it responsive as much as possible. Initially struggled to style black border similar to given design but after little bit of research learned more about following property.
- box-shadow
- when and how to use !important
- max-width and max-height
- how to scale image size using transform property.
- vertical-align
Please log in to post a comment
Log in with GitHubCommunity feedback
- @younes-atyq
Hello @shailesh7333, congrats completing the challenge!
I recommend using a fixed width for your card and employing media queries to adjust its style across different screen sizes. This will significantly enhance your card's visual appeal on various devices.
Avoid using the
!important
declaration as it can lead to style conflicts. Instead, prioritize specificity in your CSS rules. For instance, if the.blog_title
element is overridden by the style in.blog_preview_child p
, create a more specific selector like.blog_preview_child p .blog_title
to target the title within its parent element.Consider replacing generic tags like p with more semantic elements like heading tags (e.g.,
h1
,h2
) orspan
tags for better structure and styling control.Marked as helpful - @xNyfPtx
I haven't read your code yet but you should never really use important in any circumstance. Just try to keep the speficity as low as possible by using classes instead of ids for styling, avoiding descendant/combinators/child selectors such as >, + or ~ and pseudo-elements/classes such as :not, :has, as much as possible.
Also, you don't really need to scale the image size using transforms. Use width, height and the aspect-ratio properties instead. You would typically use transforms for animations most of the time
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