Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Coming Soon Page using Flex and JavaScript

Levi Kuhaulua•220
@LeviKuhaulua
A solution to the Ping single column coming soon page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

Using this segment of code:

&:has(.button:hover) :is(.email__field:invalid, .email__field:placeholder-shown) {
  border-color: var(--clr-red); 
}

I was able to accomplish the border color change for an empty email or invalid email input using only CSS. Then in JavaScript, I handled the displaying of the error message based on the state.

What challenges did you encounter, and how did you overcome them?

I had problems dealing with the mobile design where the button and email input took up the same amount of space. How I overcame that was to take advantage of Flex's flex-basis and flex-grow so that at larger screen sizes, the email input is larger than the button, and at smaller screen sizes, they take up the same space. See code below:

form {
  display: inherit; 
  flex-wrap: wrap; 

  & > * {
    flex-grow: 1; 
  }   

  & .email__field {
    flex-basis: 40ch
  } 

  & .form__btn {
    flex-basis: 20ch
  }
Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Levi Kuhaulua's solution.

Join 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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License