Responsive Layout with CSS Grid and JS Validation for Email
Design comparison
Solution retrospective
I used grid to make the laptop layout, but feel it's a bit clunky - what other ways could I have used to improve on that? Or is that the correct way?
I can probably clean up the CSS a little with some DRY application.
Community feedback
- @vanzasetiaPosted over 2 years ago
Hi, Kevin! π
Congratulations on finishing this challenge! π Good effort on this challenge! π
Some feedback from me.
- I would recommend adding
aria-describedby
to the input element that points the theid
of the error element (paragraph). Next, addaria-live
to the error element so that it's get read by the screen reader when the message appear. Also, I highly suggest using thehidden
attribute instead inline styling with JavaScript which should be avoided just like inline styling in HTML. - Don't use
br
for presentational purposes. The screen readers would read out thebr
element as "break". Let the text wrap where it needs to be or usedspan
and then make it as block element. - Always use classes to reference all the elements that you want to style. Using
id
is going to make your stylesheet have high specificity which makes it hard to maintain (especially on a big project).
I hope you find this information beneficial. Happy coding! π
Marked as helpful0 - I would recommend adding
- @isprutfromuaPosted over 2 years ago
Hi there. You did a good job π
keep improving your programming skillsπ οΈ
your solution looks great, however, if you want to improve it, you can follow these steps:
β there is no reason to store debbuging code in the repository
console.log(isValidEmail);
β you can place this code into the separated function. Dont reeat yourself
if ( isValidEmail ) { document.getElementById("invalid").style.visibility = "hidden"; document.getElementById("invalid-msg").style.visibility = "hidden"; } else { document.getElementById("invalid").style.visibility = "visible"; document.getElementById("invalid-msg").style.visibility = "visible"; }
β plese use just one css unit instead of using rems, ems and pxels
.content { text-align: center; margin: 2rem 2em; } h1 { text-transform: uppercase; font-size: 2.5rem; line-height: 42px; letter-spacing: 10.83px; font-weight: 600; margin-bottom: 1rem; }
β try to avoid styling tags
button, input, form
I hope my feedback will be helpful. You can mark it as useful if so π
Good luck and fun coding π€β¨οΈ
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