Created
March 8, 2013 22:24
-
-
Save alexcican/5120409 to your computer and use it in GitHub Desktop.
Useful CSS snippet for creating a new website. Sets typography for vertical rhythm and icon font for icons, as well as mobile, tablet, and large screen query. Based on 32px baseline height and 22px font-size for body.
This file contains hidden or 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
/*** GLOBAL ***/ | |
/**************/ | |
img, embed, object, video { | |
max-width: 100%; | |
} | |
@font-face { | |
font-family: 'sicanstudios-icons'; | |
src:url('./fonts/sicanstudios-icons.eot'); | |
} | |
@font-face { | |
font-family: 'sicanstudios-icons'; | |
font-weight: normal; | |
font-style: normal; | |
} | |
/* Use the following CSS code if you want to use data attributes for inserting your icons */ | |
[data-icon]:after { | |
font-family: 'sicanstudios-icons'; | |
content: attr(data-icon); | |
speak: none; | |
-webkit-font-feature-settings:"liga","dlig";-moz-font-feature-settings:"liga=1, dlig=1";-moz-font-feature-settings:"liga","dlig";-ms-font-feature-settings:"liga","dlig";-o-font-feature-settings:"liga","dlig"; | |
font-feature-settings:"liga","dlig"; | |
text-rendering:optimizeLegibility; | |
font-weight: normal; | |
font-variant: normal; | |
text-transform: none; | |
line-height: 1; | |
-webkit-font-smoothing: antialiased; | |
text-indent: 9999px; | |
} | |
body { | |
font-family: 'PT Sans', Helvetica, serif; | |
-webkit-font-smoothing: antialiased; | |
font-size: 1em; /* 16px */ | |
line-height: 1.77777778em; /* 32px */ | |
background: url('../images/line.jpg'); | |
color: #59544d; | |
width: 95%; | |
margin: 0 auto; | |
} | |
::-moz-selection { | |
background: #59544d; | |
color: #fdf4ea; | |
} | |
::selection { | |
background: #59544d; | |
color: #fdf4ea; | |
} | |
img, a, a:visited { | |
-moz-transition: color 0.5s, background 0.5s, box-shadow 0.4s; | |
-webkit-transition: color 0.5s, background 0.5s, box-shadow 0.4s; | |
-o-transition: color 0.5s, background 0.5s, box-shadow 0.4s; | |
transition: color 0.5s, background 0.5s, box-shadow 0.4s; | |
} | |
a, a:visited { | |
color: #4ea38d; | |
text-decoration: none; | |
} | |
/* on hover, zoom thumb image */ | |
a.img:hover img { | |
-moz-transform: scale(1.03); | |
-webkit-transform: scale(1.03); | |
-o-transform: scale(1.03); | |
transform: scale(1.03); | |
} | |
/* smooth animations */ | |
a.img img { | |
-moz-transition: all 0.5s; | |
-webkit-transition: all 0.5s; | |
-o-transition: all 0.5s; | |
transition: all 0.5s; | |
} | |
/* contain the zoomed thumb inside a element */ | |
.img, .img:hover { | |
text-decoration: none; | |
overflow: hidden; | |
display: inline-block; | |
} | |
a:hover { | |
color: #59544d; | |
cursor: pointer; | |
text-decoration: underline; | |
} | |
/* if link is an icon hides text and shows icon */ | |
.icon, .icon:visited { | |
font-size: 32px; | |
text-indent: -9999px; | |
display: inline-block; | |
position: relative; | |
min-width: 32px; | |
color: #59544d; | |
} | |
/* link colour */ | |
.icon:hover { | |
color: #4ea38d; | |
} | |
/* shows the icon */ | |
.icon:before { | |
text-indent: 0; | |
position: absolute; | |
left: 0; | |
top: 0; | |
} | |
/*** TYPOGRAPHY ***/ | |
/******************/ | |
h1 { | |
font-size: 2.28571429em; /* 48px */ | |
line-height: 1.33333333em; /* 64px */ | |
margin-bottom: 0.66665em; /* 32px */ | |
} | |
h2 { | |
font-size: 1.1429em; /* 24px */ | |
line-height: 1.33333333em; /* 32px */ | |
margin-top: 1.33333333em; | |
margin-bottom: 0em; | |
} | |
h3 { | |
font-size: 0.85714286em; /* 18px */ | |
line-height: 1.77777778em; /* 32px */ | |
margin-bottom: 1.77777778em; | |
margin-top: 0em; | |
font-weight: normal; | |
text-transform: uppercase; | |
color: #a2988a; | |
} | |
p, ul, ol, blockquote, pre { | |
font-size: 1em; /* 16px */ | |
line-height: 1.45454545em; /* 32px */ | |
margin: 0 0 1.45454545em 0; | |
padding: 0; | |
} | |
ul li, ol li { | |
padding-left: 1em; | |
margin-left: 0.9em; | |
} | |
/* slightly bigger padding because of numbers */ | |
ol li { | |
padding-left: 0.7em; | |
margin-left: 1.2em; | |
} | |
blockquote { | |
border-left: solid 5px #4ea38d; | |
background: rgba(255,255,255,0.7); | |
padding-left: 1.6em; | |
font-style: italic; | |
font-weight: bold; | |
} | |
/* code has different font/size; realign */ | |
pre { | |
border-left: solid 5px #4ea38d; | |
background: rgba(255,255,255,0.7); | |
margin: 0 0 1.77777778em 0; | |
line-height: 1.77777778em; | |
padding-left: 2em; | |
} | |
code { | |
font-family: 'Inconsolata', 'Monaco', 'Courier New', monospace; | |
font-size: 0.928em; | |
white-space: pre-wrap; | |
white-space: -moz-pre-wrap !important; | |
white-space: -pre-wrap; | |
white-space: -o-pre-wrap; | |
word-wrap: break-word; | |
} | |
/* tablet screen */ | |
@media screen and (min-width: 768px){ | |
body { | |
font-size: 1.125em; /* base font: 18px */ | |
max-width: 640px; | |
} | |
} | |
/* large screen */ | |
@media screen and (min-width: 1330px){ | |
body { | |
font-size: 1.375em; /* base font: 22px */ | |
max-width: 734px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment