Skip to content

Instantly share code, notes, and snippets.

@thierryk
Created November 26, 2011 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thierryk/1396486 to your computer and use it in GitHub Desktop.
Save thierryk/1396486 to your computer and use it in GitHub Desktop.
Base styles sheet for WebKit based browsers. It uses "rem" unit and RTL/LTR-friendly values like "start", "end", etc.
/**
* See: http://www.css-101.org/articles/base-styles-sheet-for-webkit-based-browsers/styles-sheets-optimization.php
* 30px is an arbitrary value used to create space on each side of block-level elements
* .8em is an arbitrary value used to create space above and below most block-level elements (except headings which are styled with different values)
*/
/* setting line-height and family while leaving default font-size using *rem* */
html {
font: 62.5%/1.3 sans-serif;
}
/* zeroing out the default 8px margin */
body {
font-size: 1.3rem;
margin: 0;
}
/* vertical margins common to most block-elements */
p,
blockquote,
figure,
table,
menu,
dir,
ul,
ol,
dl,
pre {
margin-top: .8em;
margin-bottom: .8em;
}
/*
* zeroing out the default 2px right/left margin
* removing the padding on four edges (.35 .75 .625 .75)
* removing the 2px pixels border
*/
fieldset {
margin: 0;
padding: 0;
border: 0;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h1 {
font-size: 1.55rem;
margin-top: 1.15em;
margin-bottom: .3em;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h2 {
font-size: 1.5rem;
margin-top: 1.1em;
margin-bottom: .4em;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h3 {
font-size: 1.45rem;
margin-top: 1.05em;
margin-bottom: .5em;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h4 {
font-size: 1.4rem;
margin-top: .95em;
margin-bottom: .6em;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h5 {
font-size: 1.35rem;
margin-top: .85em;
margin-bottom: .7em;
}
/*
* font-size and vertical margins
* margin value = font-size + .01
*/
h6 {
font-size: 1.3rem;
margin-top: .8em;
margin-bottom: .8em;
}
/* reducing the default values from 40px to 30px */
blockquote,
figure {
margin-left: 30px;
margin-right: 30px;
}
/* reducing the default values from 40px to 30px */
ul,
ol {
-webkit-padding-start: 30px;
}
/* reducing the value for nested lists */
li ul,
li ol {
-webkit-padding-start: 20px;
}
/* replacing margin with padding to allow styling the left gutter with a background image */
dd {
-webkit-padding-start: 30px;
-webkit-margin-start: 0;
margin-top: .35em;
margin-bottom: .35em;
}
/* creating space between DD and DT */
dd + dt {
margin-top: .8em;
}
/* zeroing border-collapse and border-spacing */
table {
border-collapse: collapse;
border-spacing: 0;
}
caption {
margin-bottom: .5em;
}
/* setting default alignment for cells */
tbody th {
text-align: start;
}
tbody td {
text-align: end;
}
/* border and padding cell */
th,
td {
border: 1px solid #000;
padding: .5em;
}
/* zeroing out the 2px default left/right padding */
legend {
padding: 0;
}
/* to overwrite the default styling (font:-webkit-small-control;) */
select,
input,
button,
textarea {
font: inherit;
}
/* fix for inheritance issue (Webkit/Mac bug) */
select {
background: transparent;
}
/* this is to minimize the difference with surrounding text */
strong,
b {
font-size: 90%;
}
/* zeroing out line-height so it does not increase the line box */
sub,
sup {
line-height: 0;
}
/* this depends on what's being published; in short, do we need this? */
dfn {
font-style: italic;
}
kbd,
code {
font-size: 1.5rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment