Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

Advice generator using vanilla Javascript, SCSS and AXIOS

axios, sass/scss, webpack
Cristina Kelly•140
@cristinakellyt
A solution to the Advice generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi, all! I am happy to complete this project, but I want to ask you something... in the browser, I can see the responsive design working correctly, but when I see the website on my iPhone, it's not working well, it's like the responsiveness is not applied... and I don't know why. This isn't happening with Android. Maybe if one of you has IOS and wants to test it, or give me any idea of what is going on, I would greatly appreciate it!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Steve•1,170
    @peanutbutterjlly
    Posted about 2 years ago

    hey 👋,

    to simulate phone devices (besides just squishing your browser) you can use the dev tools in Chrome/Firefox/Safari to help simulate those devices:

    Chrome

    Firefox

    Apple

    I used those tools to inspect your page and sure enough, the content does overflow on mobile screens. to help with that, try getting your div.container and removing the width: 55rem; and reduce your max-width: 55rem down to 40-50rem - maybe reduce the padding as well.

    besides that, good job on your solution!

    Marked as helpful
  • Grace•32,130
    @grace-snow
    Posted about 2 years ago

    Hi

    You are making some foundational errors in this, like using IDs as class selectors, resizing base font-size all the time and working desktop-first. Not only is this making loads more work for yourself, it is making your solution completely inaccessible.

    Here are notes and changes I just made in browser devtools. Go through each note carefully.

    It's also worth you reading my post about why resizing html font size like this is a terrible idea. There are some other posts on there that would benefit you too, like the explainer on what the ID attribute is for.

    
    /* style.b95d109e782698da0923.css | https://zk-advice-generator.netlify.app/style.b95d109e782698da0923.css */
    
    main {
    /* height: 100vh; */
    /* width: 100%; */
    min-height: 100vh;
    }
    
    .container {
    /* height: 30rem; */
    /* width: 55rem; */
    min-height: 30rem;
    margin: 1rem;
    note: the container needs an aria-live attribute on it;
    note: never limit height of text containing elements;
    note: do not set width, instead only use max width. This lets the component shrink if it needs to;
    note: the margin ive added to stop the component ever hitting screen edges;
    padding-bottom: 4.5rem;
    }
    
    #advice-text {
    /* height: 15rem; */
    note: NOT a h1. This is a blockquote or paragraph;
    note: Do not style on IDs;
    margin-block: 1.5rem;
    flex-grow: 1;
    }
    
    #advice {
    /* letter-spacing: 3px; */
    letter-spacing: 0.3em;
    note: NEVER use pixels for letter spacing. Use em;
    }
    
    @media only screen and (max-width: 36em) {
    html {
    /* font-size: 50%; */
    note: ESPECIALLY don't do this';
    }
    #advice {
    /* font-size: 1.2rem; */
    }
    }
    
    html {
    /* font-size: 62.5%; */
    note: DON"T do this!";
    }
    
    #dice {
    note: Event listeners must never be on non-interactive elements. This MUST be a button;
    }
    
    #dice img {
    note: The button must have an accessible name that describes what it does. "Dice" is meaningless as a button label;
    }
    
    @media only screen and (max-width: 28em) {
    html {
    /* font-size: 40%; */
    note: REALLY do not do this!;
    }
    }
    
    @media only screen and (max-width: 22em) {
    .container {
    /* width: 48rem; */
    }
    #advice {
    /* font-size: 1.4rem; */
    }
    }
    
    img {
    note: Decorative image so alt must be blank;
    }
    
    img {
    display: block;
    max-width: 100%;
    note: This is usually part of a modern css reset. You should always use one at the start of your styles.;
    }
    
    
    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

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.

Oops! 😬

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

Log in with GitHub

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