Design comparison
Solution retrospective
What it is when I click on each question and show the answer, is something that has always been difficult for me, since I use an incorrect way to do it, which is to do functions for each question and then select the answer. Just like when arranging the image in desktop mode, I couldn't find a way for the box not to use the hidden overflow, this to show the complete box without cropping.
Community feedback
- @pikapikamartPosted over 3 years ago
Hey just to add up, to prevent the sizes. As far as I can see, when you click an accordion, your container resizes based on it. A trick is, giving the right container a fixed height then making the overflow of it to
overflow: visible scroll
so that it doesnt resizes, then if you want the scrollbar to be hidden, you need to add some selectors to it like this/* Hide scrollbar for Chrome, Safari and Opera */ .example::-webkit-scrollbar { display: none; } /* Hide scrollbar for IE, Edge and Firefox */ .example { -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ }
this is from w3schools^
0@luispv02Posted over 3 years agoThank you very much for the comments, I will take them into account. =)
0 - @AgataLiberskaPosted over 3 years ago
Hi @luispv02!
Not sure what you mean by 'incorrect way', but the way I would do it is select all questions using
document.querySelectorAll()
method and then loop through the node list and add an event listener to the questions that way. Now that you've submitted your solution, you can browse the challenge hub and see how others dealt with it, I often find it helpful.As per overflow - you set
overflow:hidden
on the div with classheader-content
. If you want the box image to not be hidden, that image needs to be outside of that div. Basically, if you set overflow to hidden on a container, there is no way to make an exception for a single child element in that container. You need to pull it outside :)Make sure that you check the report above, it looks like there are some issues with accessibility and HTML. Another accessibility issue which is not in the report is that the questions are not accessible via keyboard, only when clicked with a mouse. You can fix that easily by using
<button>
instead of or around your<h3>
(although tbh headings should be used in order, so if you want to use a heading element, I would go for<h2>
in this case).Hope this helps :)
0@luispv02Posted over 3 years agoThank you very much for the comments, I will take them into account. =)
0
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