Hello !
I'm learning Javascript and this is my first challenge with !
How can I keep an :active effect in Javascript? On the list, before to click on the button, I wanted to keep the background and color of numbers, but I didn't succeed.
I wrote "Let list = document.queryselector("li") (or put an id and use GetElementById) and created a function. I used "onclick" but only the first li took changes, even if all li had "onclick" or an id. Someone can explain me that?
I think your question would be better resolved using semantic html and css instead of JavaScript.
instead of a using a list consider <input type="radio"> this has many more built in accessibility benefits and makes styling the input with :focus easier achieving the 'active' state
you can also tab into the input and use your arrow keys to see the focus state
styling radio inputs are a little trickier but something really worthwhile
Overall a really decent solution and responsive - well done!
A few bits of feedback for your consideration:
add {cursor: pointer;} to your buttons
swap <div class="grid container"> to a <main>. Semantic html is really important for accessibility and it should clear your report.
look into max-width to control the width of your content in a responsive way, rather than using width with percentage values. This would help your design not to stretch across the viewport at larger screens too
I noticed at different viewports your buttons are not aligned. Also if the content in the <p> were different lengths in the design you'd come up against the same challenge. I created this codepen that uses flex:1 and justify-content: space-between as potential solutions
I hope that all makes sense, any questions let me know.
I think your approach to CSS is completely fine on this size project. When your projects grow you could consider BEM to make building modular styles easier coupled with SASS to create multiple css files (partials) that relate to each component and compile to one style sheet.
Also you should embed some best practices resolving your accessibility report. Your .container<div> could be a <main> tag and your .card-title<p> could be a <h1>. Semantic html is really important.
I learned a lot from this project especially the active button I saw a lot of solutions for this project but most of them doesn't implement an active button but hopefully, I did after hours of confusing, and research finally I solve that with HTML RADIO buttons check it out.
All feedback are welcoming 🙏 have a nice day
And great perseverance to complete the solution with radio buttons too!
Some considerations for you:
check out a <fieldset> for your .rating-container. It is a semantic element to choose compared to a div and has some interesting attributes you might use in the future
you should consider adding cursor: pointer; to your interactive elements to give that additional feedback to the user on desktop
also it'd be great to see some focus states added to those interactive elements for those who navigate the component using a keyboard
lastly you could consider making the card and thank you result the same dimensions, so when it changes you don't notice a difference between the layouts as much
Overall you smashed it, with a few tweaks you could level it up even further!
add display: block; to your image, this will remove the 4 pixels difference
add mix-blend-mode: multiply; to .hero-banner > picture::after and remove the opacity to match the image colour with the design file
regarding the transition from desktop to mobile, one solution would be to bring your media query in as soon as the image gets squished. Another solution would be to use relative units (REM) not absolute units (px) to help the design scale
Try background-blend-mode: multiply; on .card-image and remove the opacity in the colour background: linear-gradient( 0deg,hsla(277, 64%, 61%) 0%,hsla(277, 64%, 61%) 100%),url(./images/image-header-desktop.jpg); to match the purple in the design to the challenge!
@abhishekdwaghmare2000Submitted almost 3 years ago
Any suggestions about improving specific part of webpage, mistakes and other suggestions about improvements are really welcome ! It would be really helpful, if you suggest the mistakes I made and the improvements need to be done at specific point or any other small thing need to be fix in this challenge.
Thank you!
Another solution to the colour is keep your current mark up but try:
For your image - remove background-color: hsla(277, 64%, 61%);. Add mix-blend-mode: multiply; and add display: block; for the little line that is created on the mobile view
Add background-color: hsla(277, 64%, 61%); to .content-right
Also
overflow: hidden; is needed to your .card class to make sure the border-radius is visible on all corners