Article Preview Component (Vanilla CSS, no JS, Custom Hover States)
Design comparison
Solution retrospective
👾 Hello, Frontend Mentor coding community. This is my solution for the Article Preview Component.
How can I fix this accessibility error?
"Form elements must have labels Context: <input type="checkbox" name="share" id="share__icon">"
What I've found harder to apply on this project, was the social media popup, once I didn`t know JavaScript yet I struggled to apply the same effect using only Html + Css and I achieved the same result for the popup on the desktop version, in the mobile version I don't have any clue how to reach the same result (on/off) to show the social media icon popup and shut off the author name section when one is active and the other dont.
If you've any tip how can I achieve it entirely with Html + Css, you're welcome.
In some months I'll try this challenge again and apply the changes using Javascript.
Thank you!
Community feedback
- @AdrianoEscarabotePosted about 2 years ago
Salve lucas! tudo bem? Muito top este desafio man, quero fazer ele em breve!
Vou te falar como podemos fazer este popup com js, mas primeiro vou te dar uma dica sobre o layout.
Observei que em resoluções maiores, as duas divs
author--mobile
emodal--mobile
estão aparecendo, podemos corrigir isso com o nosso amigomedia-query
acompanhado pelodisplay: none;
@media (max-width: 4000px) { .share__icon__popup, .modal--mobile, .author--mobile { display: none; } }
Podemos usar um
addEventListener
no icon que quando receber o click chamará a lista que conter ativo no nosso css, e com essa lista teremos os posicionamento necessário para o conteudo aparecer, e quando essa lista estiver desativada o conteúdo tera o posicionamento da lista que não temativo
no css.Por exemplo:
.social-links { display: none; posicionamentos...... }
.social-links.ativo { display: flex; }
let botaoIcon = document.getElementById('share__icon') let showLinks = document.querySelector('.social-links'); botaoIcon.addEventListener('click', function () { showLinks.parentElement.classList.toggle('ativo'); })
Ainda ta difícil explicar js, mas espero que tenha pegado a ideia, que é bem semelhante ao modo que você fez o
qr-code-dark
, mas o que ira mudar não será cores, e sim posicionamento e display.Espero que ajude! 👍
Marked as helpful0 - @Moamen31Posted over 2 years ago
Hello, Lucas. congrats on finishing the challenge. I have some tips for the mobile version:
- I see that you made another div for the author for mobile, however you do not need that, you can show the popup on the author div with position absolute and z-index. And don't forget to give the parent element position relative.
- Also give the button position relative and z-index:2; to make it appear on the popup
Marked as helpful0
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