Design comparison
Solution retrospective
Hello. Here's my solution to Challenge #10.
Notes: First time using ::after pseudo-element for the hover state, and I hope I made a good implementation of it somehow. Swapped the <img> element that has the equilibrium image to <section> as MDN states that <img> doesn't support ::after.
Community feedback
- @SadeeshaJayaweeraPosted about 1 year ago
Using the
::after
pseudo-element for hover states is a creative way to enhance your web design. Swapping the<img>
element for a<section>
element to support the::after
pseudo-element is a valid approach. However, it's essential to ensure that your implementation works effectively and maintains accessibility. Here are a few points to consider:-
Accessibility: Make sure that the content you're swapping is still accessible. If the image you replaced conveyed meaningful content, ensure that this content is accessible to users who rely on screen readers or cannot view images. You might use the
aria-label
attribute to provide a text description. -
Semantic Structure: Ensure that the use of a
<section>
element is semantically appropriate for the content you're representing. Semantically correct HTML improves accessibility and SEO. -
CSS: Verify that your CSS implementation for the
::after
pseudo-element is effective and works as intended on various browsers and screen sizes. Cross-browser testing is crucial. -
User Experience: Test your implementation thoroughly to ensure that it enhances the user experience and doesn't introduce any usability issues.
-
Performance: Consider the impact on page load times. Depending on the size and number of images you're replacing, this technique may have performance implications. Ensure that it doesn't significantly slow down your website.
In summary, using the
::after
pseudo-element for hover states and swapping the<img>
element for a<section>
element can be a valid approach, but it's important to pay attention to accessibility, semantics, CSS compatibility, user experience, and performance to ensure a successful implementation.Marked as helpful1 -
Please log in to post a comment
Log in with GitHubJoin 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