StyleDocco default styles

This is the default stylesheet for StyleDocco. It also serves as an example of the documentation syntax.

Main layout

The page content has a maximum width of 1500 pixels.

When StyleDocco encounters a first level heading, the documentation is split into a new section with a pair of documentation and CSS code.

* {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
}
body {
  /* Top/bottom paddings for bars */
  padding: 60px 0 40px;
  background-color: hsl(207, 10%, 90%);
  color: hsl(207, 5%, 30%);
}
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
}
.section {
  position: relative;
  margin-bottom: 20px;
}
.docs {
  position: relative;
  z-index: 2;
  width: 68%;
  min-height: 200px;
  background-color: hsl(207, 0%, 100%);
  background-clip: padding-box;
  border: 1px solid hsla(207, 5%, 5%, .1);
  border-radius: 5px;
  box-shadow: 0 0 3px hsla(207, 5%, 5%, .1);
}
.code {
  position: absolute;
  top: 5px; bottom: 5px;
  right: 0;
  z-index: 1;
  width: 33%;
  padding: 10px 10px 10px 20px;
  border-radius: 0 5px 5px 0;
  border: 1px solid hsla(207, 20%, 10%, .1);
  background-color: hsla(207, 20%, 95%, .9);
  background-clip: padding-box;
  opacity: .5;
  -webkit-transition: opacity .4s;
  -moz-transition:    opacity .4s;
  -o-transition:      opacity .4s;
  transition:         opacity .4s;
}
  .code:hover {
    opacity: 1;
  }

Previews and code

Previews are rendered in sandboxed iframes with the documented CSS applied. The code is editable and the previews will be automatically updated.

The width of the previews can be adjusted to test responsive designs. The height will be automatically adjusted to fit the content. Free hand resizing currently only works properly in Firefox. In WebKit browsers you can only enlarge the previews and other browsers have not implemented CSS resize .

Editable code blocks have a desaturated orange background. They will be automatically resized to fit the text inside.

Previews are placed in a resizeable container as iframe elements cannot be resized with the CSS resize property.

No code is allowed to overflow horizontally.

.preview {
  background: hsl(207, 0%, 100%);
  border-top: 1px solid hsl(207, 30%, 95%);
  position: relative;
  z-index: 1;
}
  .preview-code + .preview {
    margin-top: 0;
    border-top: 0;
  }
.preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.preview-code {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  color: hsl(207, 9%, 37%);
  max-height: 200px;
  padding: 10px 20px;
  overflow-y: auto;
  background: hsl(207, 30%, 95%);
  border: 1px solid hsl(207, 30%, 85%);
  border-left: 0; border-right;
  box-shadow: inset 0 1px 2px hsla(207, 30%, 10%, .1);
  line-height: 1.1 !important;
  resize: none;
}
  .preview-code:focus {
    outline: 0;
    background: hsl(207, 30%, 97%);
    box-shadow: inset 0 1px 2px hsla(207, 30%, 10%, .1),
                0 0 5px hsla(207, 75%, 75%, .9);
  }
  .preview-code:last-child {
    border-bottom: 0;
    border-radius: 0 0 5px 5px;
  }
.resizeable {
  padding: 15px;
  overflow: auto;
  background: hsl(207, 0%, 100%);
  box-shadow: 0 0 2px hsla(207, 10%, 20%, .2);
  resize: both;
}
.preview-code, pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}
.code pre {
  height: 100%;
  margin-top: 0;
}

Settings and configuration

.settings {
  text-align: center;
}
.bar button {
  display: inline-block;
  vertical-align: middle;
  padding: 0 5px;
  margin: 0 3px;
  background: transparent;
}
.bar button:first-child {
  margin-left: 0;
}
.settings .auto {
  line-height: 32px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: -1px;
  text-shadow: none;
  text-transform: uppercase;
}

Typography and text styles

We use the generic sans-serif font family to get Arial on Windows and Helvetica on Mac. The body font-size is set to 14px.

Paragraphs, lists, tables and blockquotes get some bottom margins as well as side margins.

Headings get font-sizes at a modular scale of 5:6.

body {
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.618;
}
.docs pre, p, ol, ul, dl,
figure, blockquote, table {
  margin-left: 20px; margin-right: 20px;
}
.preview, .docs pre,
p, ol, ul, dl,
figure, blockquote, table {
  margin-top: 10px;
}
  ul ul, ol ol, ul ol, ol ul,
  blockquote p:last-child {
    margin-top: 0;
  }
ul, ol {
  padding-left: 1.5em;
}
p:last-child, ol:last-child, ul:last-child, dl:last-child {
  margin-bottom: 20px;
}
hr,
h1, h2, h3, h4, h5, h6 {
  margin: 1em 20px .5em;
}
  h1:first-of-type {
    margin-top: 20px;
  }
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  color: hsl(207, 10%, 50%);
}
h1 a, h1 a:hover, h1 a:visited {
  color: inherit;
  text-decoration: inherit;
}
h1 {
  font-size: 3.052em;
  font-weight: normal;
  color: hsl(207, 10%, 45%);
}
h2 {
  font-size: 1.953em;
}
h3 {
  font-size: 1.536em;
}
h1, h2, h3 {
  letter-spacing: -.025em;
}
h4 {
  font-size: 1.25em;
}
h5 {
  font-size: 1em;
  text-transform: uppercase;
}
h6 {
  font-size: 1em;
}
.permalink {
  position: absolute;
  top: 15px; right: 15px;
}

Code

For displaying code, we prefer Ubuntu Mono, falling back on some fonts that should look better at smaller sizes than the default monospace fonts.

<?php
echo "Hello World;
?>

Helper classes

.preview-code,
pre, code, var {
  font-style: normal;
  font-family: "Ubuntu Mono", "Andale Mono", "DejaVu Sans Mono", "Monaco", "Bitstream Vera Sans Mono", "Consolas", "Lucida Console", monospace;
  font-size: 12px;
}
.docs pre, code, var {
  padding: .1em 3px;
  background: hsla(207, 5%, 0%, .025);
  border: 1px solid hsla(207, 5%, 0%, .05);
  border-radius: 3px;
}
.code pre {
  line-height: 1.1 !important;
}
pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

.cf:before, .cf:after { content: ''; display: table; }
.cf:after { clear: both; }
[unselectable="on"] {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
[hidden] {
  display: none !important;
}
small {
  font-size: 85%;
  opacity: .9;
}