This is a solution to the Advice generator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Generate a new piece of advice by clicking the dice icon
- Solution URL: Solution
- Live Site URL: Advice Generator App
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Vanilla JS
- Advice Slip API
- HTML
- Don't forget the following!!!
<noscript>JavaScript disabled</noscript>
- CSS
- To create the glow effect for the dice upon hover, I used a box shadow...
#diceBox:hover{box-shadow: 0.1vh 0.1vh 4vh 0.75vh hsl(150, 100%, 66%);}
- I also learnt that you can 'justify-self' and 'align-self' for individual 'child' elements
- JS
- I learnt to use an API! ('no-cache' was vital for randomisation otherwise the browser would cache the response and lead to the same advice being generated again and again
return await fetch("https://api.adviceslip.com/advice", { method: 'GET', cache: "no-cache" })
- I would like to practise working with APIs more
- Website - Man Ting Chan
- Frontend Mentor - @M-Chan