Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

Advice Generator using API with HTML, CSS and JS

MightyKale•40
@MightyKale
A solution to the Advice generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I am not sure if my styling in CSS is correct and/or consistent, especially how I positioned elements with absolute, relative and fixed. Also in the media query area, I used display: none to change the pattern divider between mobile and desktop view, and I am not sure if that's the correct way to do it. Any feedback for suggestions welcome, thank you guys in advance!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Chamu•13,860
    @ChamuMutezva
    Posted over 3 years ago

    Hi MightyKale’s. So far so good with your first challenge.

    • the display looks generally good but as the device gets smaller the image divider is not scaling well - it is overlapping the container.
    • the recommended way for dealing with responsive images is to use methods such as the srcset and picture element. Controlling the images between sizes by using display: none works, but it is not the best practice. Some of the reasons why using display: none to interchange the images is because it wastes bandwidth as the html is parsed first - hence all the images will be downloaded, making it an expensive method. That can cause you project to load slow when the site has a lot of images. I normally use the picture element, here is a site that can get you started Responsive Images 101
    • the first heading element of your site should be an h1, heading elements should follow a sequential order without skipping heading elements.
    • use semantic elements where possible, one case is where you used the div for interactive purposes. Click events should be associated with an element such as a button , a div is not recommended to use - it has no semantic meaning. Assistive technology users will not be able to interact with your site.
    • the advice message is not changing if i click the dice. Try to clear the cache by editing the fetch statement as follows `const response = await fetch(apiUrl, {cache: "no-cache"});
    Marked as helpful
  • Eslam Ismail•390
    @eslam-94
    Posted over 3 years ago

    great work

  • sansarj17•180
    @sansarj17
    Posted over 3 years ago

    Hello Kale, Congrats on completing the challenge.

    My suggestion would be to light up the dice when the person hovers on it so the user knows that he can interact with it. As for the divider, I think using anyone would have been fine and you can scale up/down the divider image according to the viewport. However, I do like how you tackled the issue.

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

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

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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