Skip to content

Instantly share code, notes, and snippets.

@march213
Created July 31, 2018 16:16
Show Gist options
  • Save march213/8d54147507735ac9ea2a687d25b30f55 to your computer and use it in GitHub Desktop.
Save march213/8d54147507735ac9ea2a687d25b30f55 to your computer and use it in GitHub Desktop.
Default styles with responsive typography
@charset "UTF-8";
html{
font-family:"PT Serif", Georgia, serif;
font-size:100%;
line-height:1.6;
background:#fff;
color:#000;
-webkit-overflow-scrolling:touch; }
body{
margin:1em;
font-size:1rem; }
@media (min-width: 20rem){
body{
font-size:calc(1rem + 0.0125 * (100vw - 20rem)); } }
@media (min-width: 40rem){
body{
font-size:1.25rem; } }
body header,
body main,
body footer,
body article{
position:relative;
max-width:40rem;
margin:0 auto; }
body > header{
margin-bottom:3.5em; }
body > header h1{
margin:0;
font-size:1.5em; }
body > header p{
margin:0;
font-size:.85em; }
body > footer{
margin-top:4.5em;
padding-bottom:1.5em;
text-align:center;
font-size:.8rem;
color:#aaa; }
nav{
margin:1em 0; }
nav ul{
list-style:none;
margin:0;
padding:0; }
nav li{
display:inline-block;
margin-right:1em;
margin-bottom:.25em; }
nav a:visited{
color:#0064c1; }
nav a:hover{
color:#3000c1; }
ul, ol{
margin-top:0;
padding-top:0;
padding-left:2.5em; }
p{
margin:1em 0;
-webkit-hyphens:auto;
-ms-hyphens:auto;
hyphens:auto; }
p:first-child{
margin-top:0; }
p:last-child{
margin-bottom:0; }
p + ul, p + ol{
margin-top:-.75em; }
p img, p picture{
float:right;
margin-bottom:.5em;
margin-left:.5em; }
p picture img{
float:none;
margin:0; }
dd{
margin-bottom:1em;
margin-left:0;
padding-left:2.5em; }
dt{
font-weight:700; }
blockquote{
margin:0;
padding-left:2.5em; }
aside{
margin:.5em 0;
font-style:italic;
color:#aaa; }
@media (min-width: 65rem){
aside{
position:absolute;
right:-12.5rem;
width:9.375rem;
max-width:9.375rem;
margin:0;
padding-left:.5em;
font-size:.8em;
border-left:1px solid #f2f2f2; } }
aside:first-child{
margin-top:0; }
aside:last-child{
margin-bottom:0; }
section + section{
margin-top:2em; }
h1, h2, h3, h4, h5, h6{
margin:1.25em 0 0;
line-height:1.2; }
h1:hover > a[href^='#'][id], h1:focus > a[href^='#'][id], h2:hover > a[href^='#'][id], h2:focus > a[href^='#'][id], h3:hover > a[href^='#'][id], h3:focus > a[href^='#'][id], h4:hover > a[href^='#'][id], h4:focus > a[href^='#'][id], h5:hover > a[href^='#'][id], h5:focus > a[href^='#'][id], h6:hover > a[href^='#'][id], h6:focus > a[href^='#'][id]{
opacity:1;
transition:opacity 0s, color 300ms ease-out; }
h1 + p, h1 + details, h2 + p, h2 + details, h3 + p, h3 + details, h4 + p, h4 + details, h5 + p, h5 + details, h6 + p, h6 + details{
margin-top:.5em; }
h1 > a[href^='#'][id], h2 > a[href^='#'][id], h3 > a[href^='#'][id], h4 > a[href^='#'][id], h5 > a[href^='#'][id], h6 > a[href^='#'][id]{
position:absolute;
left:-.5em;
opacity:0;
background:none;
color:rgba(0, 0, 0, 0.5);
transition:opacity 300ms ease-out; }
h1 > a[href^='#'][id]:target, h1 > a[href^='#'][id]:hover, h1 > a[href^='#'][id]:focus, h2 > a[href^='#'][id]:target, h2 > a[href^='#'][id]:hover, h2 > a[href^='#'][id]:focus, h3 > a[href^='#'][id]:target, h3 > a[href^='#'][id]:hover, h3 > a[href^='#'][id]:focus, h4 > a[href^='#'][id]:target, h4 > a[href^='#'][id]:hover, h4 > a[href^='#'][id]:focus, h5 > a[href^='#'][id]:target, h5 > a[href^='#'][id]:hover, h5 > a[href^='#'][id]:focus, h6 > a[href^='#'][id]:target, h6 > a[href^='#'][id]:hover, h6 > a[href^='#'][id]:focus{
opacity:1;
box-shadow:none;
color:#000;
transition:opacity 0s, color 0s; }
h1 > a[href^='#'][id]:target:focus, h2 > a[href^='#'][id]:target:focus, h3 > a[href^='#'][id]:target:focus, h4 > a[href^='#'][id]:target:focus, h5 > a[href^='#'][id]:target:focus, h6 > a[href^='#'][id]:target:focus{
outline:none; }
h1 > a[href^='#'][id]::before, h2 > a[href^='#'][id]::before, h3 > a[href^='#'][id]::before, h4 > a[href^='#'][id]::before, h5 > a[href^='#'][id]::before, h6 > a[href^='#'][id]::before{
content:'•'; }
h1{
font-size:2em; }
h2{
font-size:1.75em; }
h3{
font-size:1.25em; }
h4{
font-size:1.15em; }
h5{
font-size:1em; }
h6{
margin-top:1em;
font-size:1em;
color:#aaa; }
article + article{
margin-top:5em; }
article header p{
font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:.6em;
color:#aaa; }
article header p + h1, article header p + h2{
margin-top:-.25em; }
article header h1 + p, article header h2 + p{
margin-top:.25em; }
article header h1 a, article header h2 a{
color:#000;
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="1"%3E%3Crect x="0" y="0.5" width="1" height="0.5" fill="rgba(0, 0, 0, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; }
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){
article header h1 a, article header h2 a{
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="2"%3E%3Crect x="0" y="1" width="1" height="1" fill="rgba(0, 0, 0, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; } }
article header h1 a:visited, article header h2 a:visited{
color:#aaa;
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="1"%3E%3Crect x="0" y="0.5" width="1" height="0.5" fill="rgba(170, 170, 170, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; }
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){
article header h1 a:visited, article header h2 a:visited{
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="2"%3E%3Crect x="0" y="1" width="1" height="1" fill="rgba(170, 170, 170, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; } }
article header h1 a:visited:hover, article header h2 a:visited:hover{
color:#3000c1; }
article > footer{
margin-top:1.5em;
font-size:.85em; }
a{
text-decoration:none;
color:#0064c1;
transition:color 300ms ease-out, box-shadow 300ms ease-out;
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="1"%3E%3Crect x="0" y="0.5" width="1" height="0.5" fill="rgba(0, 100, 193, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; }
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){
a{
background:url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="2"%3E%3Crect x="0" y="1" width="1" height="1" fill="rgba(0, 100, 193, 0.35)"/%3E%3C/svg%3E') left bottom repeat-x; } }
a:visited{
color:#80b2e0; }
a:hover, a:active{
outline-width:0; }
a:hover{
box-shadow:inset 0px -1px #3000c1;
color:#3000c1;
transition:color 0s, box-shadow 0s; }
abbr{
margin-right:-.075em;
-webkit-hyphens:none;
-ms-hyphens:none;
hyphens:none;
letter-spacing:.075em;
font-size:.9em; }
img, picture{
display:block;
max-width:100%;
margin:0 auto; }
audio, video{
width:100%;
max-width:100%; }
video{
-o-object-position:0 -1px;
object-position:0 -1px; }
figure{
margin:1em 0 .5em;
padding:0; }
figure + p{
margin-top:.5em; }
figure figcaption{
opacity:.65;
font-size:.85em; }
table{
display:inline-block;
border-spacing:0;
border-collapse:collapse;
overflow-x:auto;
max-width:100%;
text-align:left;
vertical-align:top;
background:linear-gradient(rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%) 0 0, linear-gradient(rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%) 100% 0;
background-attachment:scroll, scroll;
background-size:1px 100%, 1px 100%;
background-repeat:no-repeat, no-repeat; }
table caption{
font-size:.9em;
background:#fff; }
table td, table th{
padding:.35em .75em;
vertical-align:top;
font-size:.9em;
border:1px solid #f2f2f2;
border-top:0;
border-left:0; }
table td:first-child, table th:first-child{
padding-left:0;
background-image:linear-gradient(to right, white 50%, rgba(255, 255, 255, 0) 100%);
background-size:2px 100%;
background-repeat:no-repeat; }
table td:last-child, table th:last-child{
padding-right:0;
border-right:0;
background-image:linear-gradient(to left, white 50%, rgba(255, 255, 255, 0) 100%);
background-position:100% 0;
background-size:2px 100%;
background-repeat:no-repeat; }
table td:only-child, table th:only-child{
background-image:linear-gradient(to right, white 50%, rgba(255, 255, 255, 0) 100%), linear-gradient(to left, white 50%, rgba(255, 255, 255, 0) 100%);
background-position:0 0, 100% 0;
background-size:2px 100%, 2px 100%;
background-repeat:no-repeat, no-repeat; }
table th{
line-height:1.2; }
code, kbd, var, samp{
font-family:Consolas, "Lucida Console", Monaco, monospace;
font-style:normal; }
pre{
overflow-x:auto;
font-size:.8em;
background:linear-gradient(rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%) 0 0, linear-gradient(rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%) 100% 0;
background-attachment:scroll, scroll;
background-size:1px 100%, 1px 100%;
background-repeat:no-repeat, no-repeat; }
pre > code{
display:inline-block;
overflow-x:visible;
box-sizing:border-box;
min-width:100%;
border-right:3px solid #fff;
border-left:1px solid #fff; }
hr{
height:1px;
margin:2em 0;
border:0;
background:#f2f2f2; }
details{
margin:1em 0; }
details[open]{
padding-bottom:.5em;
border-bottom:1px solid #f2f2f2; }
summary{
display:inline-block;
font-weight:700;
border-bottom:1px dashed;
cursor:pointer; }
summary::-webkit-details-marker{
display:none; }
noscript{
color:#d00000; }
::-moz-selection{
background:rgba(0, 100, 193, 0.15); }
::selection{
background:rgba(0, 100, 193, 0.15); }
@march213
Copy link
Author

@march213
Copy link
Author

@march213
Copy link
Author

More about typography https://matejlatin.co.uk/

@march213
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment