
Responsive interactive card form with mobile-first approach
Design comparison
Solution retrospective
The challenge gave me a really hard time when I tried to position the elements on the page. In the end, I reached the desired result, but there are still some small issues I haven't managed to solve, like:
- when focused, the inputs don't have rounded corners. Thanks to Stack Overflow I've managed to make the color of the focused input with the gradient but the property border-radius doesn't work with it 😔
- I wonder whether there is a better solution to make the card number input have spaces between every 4 digits entered. Right now I force a user to make these spaces manually by showing a corresponding error message, but as I understand the input should make it automatically.
If you have any ideas on how to deal with the issues or just want to leave general feedback on my solution, please do it) thanks in advance🙂
Community feedback
- @lawrence-yoonPosted over 1 year ago
Hello Roksolana,
I've also just completed this same project, and have a solution for one of your problems.
For the formatting of the card number input, you need to send the data through a function that will return the modified/formatted string. I wrote something that worked for me. Please see code below:
const formattedCardNumber = () => { let string = ""; for (let i = 0; i < cardInfo.cardNumber.length; i += 4) { string = string + cardInfo.cardNumber.substring(i, i + 4) + " "; } return string; };
As for the rounded corners for input when focused, I am not too sure. I took a quick peek at your css file, perhaps you need to add(initialize?) border under the focus selector, so that the border-radius has something to work with? For my focus states I used outline instead of border, which I think is a nicer approach, due to not affecting the layouts by shifting things by the border's width pixels.
Marked as helpful1@RoksolanaVeresPosted over 1 year agoHi, Larry! Thank you very much for the feedback. I'll try to fix my solution based on your recommendations)
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