Intro component with sign-up form
Design comparison
Solution retrospective
Hi.
I was not able to place the exclamation sign into the input fields, as suggested by the challenge template. I would really like to learn how to do that.
And, as usual, what could have been better done?
Community feedback
- @dwhensonPosted over 3 years ago
Hey @odpinerosh - you've done some nice work here! 🙌 Good job as the site looks good on desktop and mobile. 👍
With regards your question on center alignment of the icon, this is a pattern that comes up again and again so it's worth spending a bit of time getting comfortable with it. I use the following approach:
-
Wrap the
input
andimg
in a parent elephant - I tend to use alabel
for this which helps meet accessibility requirements. Set the label asposition: relative
-
On the
img
if you want it at the right side, addposition: absolute
,right: 0
- swap this to left if you want it on the other side. -
We now need to center the icon in the input vertically, I use something like
top: 50%
and thentransform: translateX(-50%)
to do this.
Hopefully that should work, if not have a play around as I might have got some of the details wrong, but in general it works for me.
The only other thing I would suggest is that you switch your final
input
to abutton
for to enable the form to be submitted.Hope this helps and great work here! Keep up the good work!! 👍 Cheers 👋
1@odpineroshPosted over 3 years agoThank you so much. I will keep that in mind. : )
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