Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Responsive Advice Generating App with HTML, CSS and JS

Gabriela•100
@ga-bri-ela
A solution to the Advice generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi everyone!

This was my first time working with an API independently (without following a tutorial). It was quite straightforward and really helped me build confidence to take on bigger challenges with APIs.

My biggest struggle was with the positioning of the button. I am not really happy with how I solved it, and I will look into other solutions to find something more efficient. If you have any advice, I am happy to hear it.

Any feedback is welcomed and appreciated. Thank you in advance!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Miran Legin•740
    @miranlegin
    Posted over 2 years ago

    Hi Gabriela,

    congratulations on completing this challenge!

    I have couple of suggestions to make this even better in my opinion.

    1. styling elements based on their name instead of css value is not flexible because i would suggest that you use <q> instead of <h2> for the quote itself. Not only it is better from semantic point of view but the added benefit is that you get quotation marks by default. More info here
    2. remove the height completely like previous commenter explained because when working with dynamic data you can never know how much of a text there is

    Keep coding!

    Cheers, Miran

    Marked as helpful
  • P
    Dave•5,295
    @dwhenson
    Posted over 2 years ago

    Hello Gabriella,

    Lovely job here! In response to your button challenge here is what I would do:

    1. Remove the fixed height from the square-background. I would suggest in general to avoid setting heights if possible and use content, and if needed padding, to create a larger element.
    2. On the button, remove the absolute positioning, and add transform: translateY(50%), and that should do it.

    Transforms to position an element are great as they don't impact performance, and unusually for CSS, the percentage refers to the element being targeted, not its parent.

    So in this case we are telling the element to move down 50% of its height. Which is about where you want it I think? This also avoids hard coding pixel values which can make responsive design pretty tricky.

    Hope this helps and nice work on the fetch call. Nice that you got some JS working!

    Cheers Dave

    Marked as helpful

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
Frontend Mentor logo

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

Frontend Mentor

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

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub