@AndyAshley
Posted
Hey Allyson, great job on the challenge! It looks/ works great! To keep your submit button from “submitting” or auto refreshing the page by default you can add a function to handle the click. A lot of people do something like a custom handleSubmit()
function followed by a prevent default, or add an even listener tied to the button that prevents the default
yourSelector.addEventListener(“click”, (e) => {e.preventDefault()
})
Then they add what they want the button to do in an on click for handleSubmit()
.
I think I may have used some transparency in mine as well. But I’ve noticed the screenshots may have been taken in Firefox, and chrome can display things a bit different.
As for centering the text within its background, if you’re using display: flex
make sure the parent element has enough room(sometimes need to add a height or width) and use justify-content: center
and align-items: center
for most cases. Can also pull out the align-self
or justify-self
. Hope that helps! Great job and happy coding ! 😀
Marked as helpful
@allyson-s-code
Posted
@AndyAshley Thanks so much! I will add the handleSubmit()
function with the prevent default. That sounds perfect. I'll also check out my flex styles again.
Very helpful, thank you!