-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jessicarush
committed
Aug 6, 2019
1 parent
a4e0b55
commit 621a0bc
Showing
12 changed files
with
271 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@charset "UTF-8"; | ||
|
||
|
||
|
||
/* VARIABLES -------------------------------------------------------------- */ | ||
|
||
:root { | ||
--heading-font: 'Open Sans', sans-serif; | ||
--main-font: 'Open Sans', sans-serif; | ||
--minor-font: 'Open Sans', sans-serif; | ||
--heading-color: rgba(0,0,50,.9); | ||
--main-color: rgba(70,70,90,.9); | ||
--minor-color: rgb(190,190,200); | ||
--emphasis-color: rgb(27,211,165); | ||
} | ||
|
||
|
||
|
||
/* DEFAULTS --------------------------------------------------------------- */ | ||
|
||
html { | ||
color: var(--main-color); | ||
font-family: var(--main-font); | ||
font-size: 16px; | ||
font-weight: 400; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
} | ||
|
||
/* TYPOGRAPHY ------------------------------------------------------------- */ | ||
|
||
.primary-heading { | ||
color: var(--heading-color); | ||
font-family: var(--heading-font); | ||
font-size: 2rem; | ||
font-weight: 400; | ||
} | ||
|
||
|
||
/* LINKS & BUTTONS -------------------------------------------------------- */ | ||
|
||
/* LAYOUT ----------------------------------------------------------------- */ | ||
|
||
.content-box { | ||
background: rgb(242,244,248); | ||
padding: 15px; | ||
} | ||
|
||
.is-hidden { | ||
transition: max-height 0.5s; | ||
overflow: hidden; | ||
max-height: 0; | ||
} | ||
|
||
.trigger:hover > .is-hidden { | ||
max-height: var(--js-scrollHeight); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
/* COMPONENTS ------------------------------------------------------------- */ | ||
|
||
/* COSMETIC --------------------------------------------------------------- */ | ||
|
||
/* UTILITY ---------------------------------------------------------------- */ | ||
|
||
/* STATE ------------------------------------------------------------------ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Height Transition</title> | ||
<link href="base.css" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet"> | ||
<script src="script.js" defer></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<header> | ||
<h1 class="primary-heading">CSS Height Transition</h1> | ||
<nav></nav> | ||
</header> | ||
|
||
<main> | ||
|
||
<div class="content-box trigger"> | ||
<p>Hover to see a height transition.</p> | ||
<div class="is-hidden">This demo is full of issues. None of the browsers seem to be able to calculate the scrollHeight properly when using a google font. If I use a generic font, all is well. Next, this doesn't really work at all in firefox. Mozilla says "When an element's content does not generate a vertical scrollbar, then its scrollHeight property is equal to its clientHeight property." clientHeight logs as being undefined and scrollHeight logs as being 77px. The only way I was able to work-around this was to multiply the scrollHeight by a guessed amount like 1.7. Not an ideal solution at all. Lastly, Firefox seems to completely ignore line-height and width so overall it's crap.</div> | ||
</div> | ||
|
||
</main> | ||
|
||
<footer> | ||
</footer> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function setHeight() { | ||
let el = document.querySelector('.is-hidden'); | ||
let height = el.scrollHeight; | ||
console.log(el.scrollHeight, el.clientHeigh); | ||
console.log(el.scrollWidth, el.clientWidth); | ||
el.style.setProperty('--js-scrollHeight', (height * 1.7) + 'px'); | ||
} | ||
|
||
|
||
setHeight(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@charset "UTF-8"; | ||
|
||
|
||
|
||
/* VARIABLES -------------------------------------------------------------- */ | ||
|
||
:root { | ||
--heading-font: 'Open Sans', sans-serif; | ||
--main-font: 'Open Sans', sans-serif; | ||
--minor-font: 'Open Sans', sans-serif; | ||
--heading-color: rgba(0,0,50,.9); | ||
--main-color: rgba(70,70,90,.9); | ||
--minor-color: rgb(190,190,200); | ||
--emphasis-color: rgb(27,211,165); | ||
} | ||
|
||
|
||
|
||
/* DEFAULTS --------------------------------------------------------------- */ | ||
|
||
html { | ||
color: var(--main-color); | ||
font-family: var(--main-font); | ||
font-size: 16px; | ||
font-weight: 400; | ||
} | ||
|
||
/* TYPOGRAPHY ------------------------------------------------------------- */ | ||
|
||
.primary-heading { | ||
color: var(--heading-color); | ||
font-family: var(--heading-font); | ||
font-size: 2rem; | ||
font-weight: 400; | ||
width: 300px; | ||
} | ||
|
||
.box-shadow-transition { | ||
box-shadow: inset 0 -.5em 0 rgb(145,252,240); | ||
transition: box-shadow .2s ease-in-out; | ||
} | ||
|
||
.box-shadow-transition:hover { | ||
box-shadow: inset 0 -1.4em 0 rgb(255,200,200); | ||
} | ||
|
||
/* LINKS & BUTTONS -------------------------------------------------------- */ | ||
|
||
/* LAYOUT ----------------------------------------------------------------- */ | ||
|
||
/* COMPONENTS ------------------------------------------------------------- */ | ||
|
||
/* COSMETIC --------------------------------------------------------------- */ | ||
|
||
/* UTILITY ---------------------------------------------------------------- */ | ||
|
||
/* STATE ------------------------------------------------------------------ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS box-shadow transition</title> | ||
<link href="base.css" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
|
||
<header> | ||
<h1 class="primary-heading"> | ||
<span class="box-shadow-transition">CSS box-shadow transition using inset value</span> | ||
</h1> | ||
<nav></nav> | ||
</header> | ||
|
||
<main> | ||
</main> | ||
|
||
<footer> | ||
</footer> | ||
|
||
</body> | ||
</html> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters