styling for mobile & desktop versions finished(?)

This commit is contained in:
Robert McGovern 2022-10-04 13:08:30 +01:00
parent 6797bf0b5e
commit 4f87fa5031
3 changed files with 210 additions and 10 deletions

View File

@ -0,0 +1,159 @@
/*
* Design Sizing
* Desktop 1440x810
* Mobile 375x667
*/
*,
::before,
::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
/* Colors */
--col-primary-light-cyan: hsl(193, 38%, 86%);
--col-primary-neon-green: hsl(150, 100%, 66%);
--col-neutral-grayish-blue: hsl(217, 19%, 38%);
--col-neutral-dark-grayish-blue: hsl(217, 19%, 24%);
--col-neutral-dark-blue: hsl(218, 23%, 16%);
/* Typography */
--fs-advice-title: 0.6875rem;
--lh-advice-title: 0.9375rem; /* or 15.03px */
--ls-advice-title: 0.2161rem;
--fw-advice-title: 800;
--text-align-advice-title: center;
--fs-advice-quote: 1.5rem;
--lh-advice-quote: 2.0625rem; /* or 32.78px */
--ls-advice-quote: -0.257143px; /* or -0.26px */
--text-align-advice-quote: center;
/* Styling */
/* Positioning */
--margin-top--advice__title: 2.5rem;
--margin-bottom--advice__title: 1.5rem;
--margin-bottom--advice__quote: 1.5rem;
--margin-bottom--advice__divider: 4rem;
--padding-sides--advice__section: 1.5rem;
--width--advice__button: 4rem;
/* Other */
--img-divider: url(images/pattern-divider-mobile.svg);
}
body {
min-height: 100vh;
font-family: "Manrope", sans-serif;
background-color: var(--col-neutral-dark-blue);
display: grid;
place-content: center;
margin: auto 1rem;
}
.advice__section {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
background-color: var(--col-neutral-dark-grayish-blue);
border-radius: 0.625rem;
padding: 0 var(--padding-sides--advice__section);
box-shadow: 30px 50px 80px rgba(0, 0, 0, 0.100202);
max-width: 33.75rem;
}
.advice__title {
font-size: var(--fs-advice-title);
line-height: var(--lh-advice-title);
letter-spacing: var(--ls-advice-title);
color: var(--col-primary-neon-green);
text-transform: uppercase;
text-align: var(--text-align-advice-title);
margin-top: 2.5rem;
margin-bottom: 1.5rem;
}
.advice__quote {
font-size: var(--fs-advice-quote);
line-height: var(--lh-advice-quote);
letter-spacing: var(--ls-advice-quote);
color: var(--col-primary-light-cyan);
text-align: var(--text-align-advice-quote);
margin-bottom: 1.5rem;
}
.advice__divider {
margin-bottom: 4rem;
}
.advice__button {
background-color: var(--col-primary-neon-green);
border: none;
border-radius: 50%;
width: var(--width--advice__button);
aspect-ratio: 1;
cursor: pointer;
position: absolute;
bottom: calc(var(--width--advice__button) / -2);
}
.advice__button:is(:focus, :hover) {
box-shadow: 0px 0px 40px #53ffaa;
}
@media screen and (min-width: 800px) {
:root {
/* Colors */
/* Typography */
--fs-advice-title: 0.8125rem;
--lh-advice-title: 1.125rem; /* or 17.76px */
--ls-advice-title: 0.2554rem; /* or 4.09px */
--fs-advice-quote: 1.75rem;
--lh-advice-quote: 2.375rem; /* or 38.25px */
--ls-advice-quote: -0.3px; /* or -0.26px */
/* Styling */
/* Positioning */
--margin-top--advice__title: 3rem;
--margin-bottom--advice__quote: 2.5rem;
--margin-bottom--advice__divider: 4.5rem;
--padding-sides--advice__section: 3rem;
/* Other */
--img-divider: url(images/pattern-divider-desktop.svg);
}
}

View File

@ -1,28 +1,63 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device --> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- displays site properly based on user's device -->
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<title>Frontend Mentor | Advice generator app</title> <title>Frontend Mentor | Advice generator app</title>
<!-- Feel free to remove these styles or customise in your own stylesheet 👍 --> <!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style> <style>
.attribution { font-size: 11px; text-align: center; } .attribution {
.attribution a { color: hsl(228, 45%, 44%); } font-size: 11px;
text-align: center;
}
.attribution a {
color: hsl(228, 45%, 44%);
}
</style> </style>
</head> </head>
<body> <body>
Advice #<!-- Advice ID goes here --> <section class="advice__section">
<header>
<h1 class="advice__title">
<!-- Advice ID goes here -->
Advice #
</h1>
</header>
<blockquote>
<p class="advice__quote">
<!-- Advice text goes here -->
</p>
</blockquote>
"<!-- Advice text goes here -->" <picture>
<source srcset="images/pattern-divider-desktop.svg" media="(min-width: 1000px)" />
<img src="images/pattern-divider-mobile.svg" aria-hidden="true" alt="" class="advice__divider" />
</picture>
<button class="advice__button" aria-label="Retrieve random advice">
<img src="images/icon-dice.svg" alt="Dice icon" srcset="" aria-hidden="true">
</button>
</section>
<div class="attribution">
<!-- <div class="attribution">
Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>.
Coded by <a href="#">Your Name Here</a>. Coded by <a href="#">Your Name Here</a>.
</div> </div> -->
</body> </body>
</html> </html>

View File

@ -0,0 +1,6 @@
// api used is at https://api.adviceslip.com
// specifically https://api.adviceslip.com/advice
// which takes a callback parameter
// advice is cached for 2 seconds
// so my plan is to disable the button for those
// 2 seconds