As Dabilu Sports is currently in the process of transforming from a small startup company to a bigger corporation, we felt the need to develop a Styleguide for our brand. It consists of three main parts: the brand guide, the defined CSS methodologies and the component library to be used.
The primary brand colors are used to represent Dabilu Sports in public and must reflect the Dabilu Sports brand. These colors are part of our corporate identity.
.testclass {
backgroundcolor: $porcelain;
}
If colors are used in SCSS classes, they may only be applied as variables. All colors we are using have their own variable.
.shodow-class {
color: $color-shadow;
...
}
.primary-class {
color: $color-primary;
...
}
.accent-class {
color: $color-accent;
...
}
.background-class {
color: $color-background;
...
}
.background-shade-class {
color: $color-background-shade;
...
}
.background-invert-class {
color: $color-background-invert;
...
}
.text-class {
color: $color-text;
...
}
.text-weak-class {
color: $color-text-weak;
...
}
.text-strong-class {
color: $color-text-strong;
...
}
.heading-class {
color: $color-text-heading;
...
}
.text-invert-class {
color: $color-text-invert;
...
}
.text-link-class {
color: $color-text-link;
...
}
.text-link-visited-class {
color: $color-text-link-visited;
...
}
.text-link-hover-class {
color: $color-text-link-hover;
...
}
.boder-class {
color: $color-boder;
...
}
Summary: Use Montserrat for headlines, and Open Sans for running text.
A default base size of 16px is assumed. A scale of 1.333 (Perfect Fourth) is used for increased clarity. Running text should be in medium size, headings are larger. Small font size is used, for example, for time stamps and legal information such as General Terms and Conditions.
Extra extra extra large - 3.157em (50.15px)
Extra extra large - 2.369em (37.904px)
Extra large - 1.777em (28.432px)
Large - 1.333em (21.328px)
Medium - 1em (16px)
Small - 0.75em (12px)
Extra small - 0.563em (9.008px)
<p class="font-size-xxxl">...</p>
<p class="font-size-xxl">...</p>
<p class="font-size-xl">...</p>
<p class="font-size-l">...</p>
<p class="font-size-m">...</p>
<p class="font-size-s">...</p>
<p class="font-size-xs">...</p>
This section contains the Logo Usage Guidelines for Dabilu Sports.
The Dabilu Sports Logo is comprised of the two laurel leafs on the left and right side, the three stars in the middle on top (mark) and the Dabilu Sports lettering (logotype).
The logotype is custom designed lettering and should never be replaced by a font or any other type.
The mark and logotype must never be used seperately!
When color is an option the following colors must be used (usage as shown in the logo image above):
You can find all the available colors in the Colors section.
The dimensions of the artwork have been selected accordingly and should never be altered. Examples below show improper usage:
For maximum performance, it is recommended that the minimum size for reproduction of the artwork is 90 pixels in width, whilst retaining the original set dimensions. This roughly equates to 24mm across on paper.
To protect the integrity of the Dabilu Sports brand and to achieve maximum recognition, it is important for assisting graphical elements, or other company logos, to not be in direct contact with the Dabilu Sports logo artwork.
By visually imagining a containing box around the artwork, any assisting elements should be at least a "D"s width away from the logo artwork.
.block__element--modifier {
color: $color-primary;
font-family: 'Open Sans', sans-serif;
}
.block__element--modifier, .block{
color:#2C3e50;
font-family: 'Open Sans',sans-serif
}
While some of these rules are checked through linting, as described in section Pre-Processors, the programmer must not solely rely on linting, but keep the rules in mind and follow them thoroughly.
To ensure a consistency, the file structure of websites should follow a basic guideline. As way of example, the file structure of this CSS styleguide is explained in this section.
In the main folder, the configuration files can be found:
Furthermore, there are 3 important folders:
The building process of the CSS files makes use of gulp and PostCSS and consists of several steps:
Our styleguide follows the Block, Element, Modifier Architecture. Every CSS class has to be named according to the following rules. This section is a citation from: http://getbem.com/naming/
Encapsulates a standalone entity that is meaningful on its own. While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy. Holistic entities without DOM representation (such as controllers or models) can be blocks as well.
<div class="block">...</div>
.block {
color: $color-primary;
}
Parts of a block and have no standalone meaning. Any element is semantically tied to its block.
Element names may consist of Latin letters, digits, dashes and underscores. CSS class is formed as block name plus two underscores plus element name: .block__elem
Any DOM node within a block can be an element. Within a given block, all elements are semantically equal.
<div class="block">
...
<span class="block__elem">...</span>
</div>
Good
.block__elem {
color: #042;
}
Bad
.block .block__elem {
color: #042;
}
div.block__elem {
color: #042;
}
Flags on blocks or elements. Use them to change appearance, behavior or state.
Modifier names may consist of Latin letters, digits, dashes and underscores. CSS class is formed as block’s or element’s name plus two dashes: .block--mod or .block__elem--mod and .block--color-black with .block--color-red. Spaces in complicated modifiers are replaced by dash.
Modifier is an extra class name which you add to a block/element DOM node. Add modifier classes only to blocks/elements they modify, and keep the original class:
Good
<div class="block block--mod">
...
</div>
<div class="block block--size-big block--shadow-yes">
...
</div>
Bad
<div class="block--mod">
...
</div>
Use modifier class name as selector:
.block--hidden {
...
}
To alter elements based on a block-level modifier:
.block--mod .block__elem {
...
}
Element modifier:
.block__elem--mod {
...
}
Take a look at the typography section for additional information on font sizes.
<h1 class="heading heading--extra-large">...</h1>
<h2 class="heading heading--large">...</h2>
<h3 class="heading heading--medium">...</h3>
<h4 class="heading heading--small">...</h4>
To keep a clear and simple structure, heading level 5 (h5) and 6 (h6) must not be used.
If the ordering of the items you want to display is relevant, use an ordered list. Otherwise use an unordered list.
<ol class="list list--ordered">
<li class="list__item">...</li>
<li class="list__item">...</li>
</ol>
<ul class="list list--unordered">
<li class="list__item">...</li>
<li class="list__item">...</li>
</ul>
Our forms have to be in a really good shape, just like our brand models. Here is the guide on how to implement all kinds of form elements.
Basic text input fields should be styled as follows:
<form class="form">
<div class="form__flex">
<div class="form__float">
<label for="required_input" class="form__label">Required Field: *</label>
<input class="form__input form__input--required" id="required_input" type="text" placeholder="Max@Mustermann.org"></input>
</div>
<div class="form__float">
<label for="optional_input" class="form__label">Optional Field:</label>
<input class="form__input" id="optional_input" type="text" placeholder="Phone"></input>
</div>
</div>
<div class="form__flex">
<div class="form__float">
<label for="valid_input" class="form__label">Valid Field</label>
<input class="form__input form__input--valid" id="valid_input" type="text" placeholder="Valid"></input>
</div>
<div class="form__float">
<label for="invalid_input" class="form__label">Invalid Field</label>
<input class="form__input form__input--invalid" id="invalid_input" type="text" placeholder="Invalid"></input>
</div>
</form>
Textareas should be styled as follows:
<form class="form">
<label for="textarea" class="form__label">Place your thoughts</label>
<textarea class="form__textarea" id="textarea" type="text" rows="6" cols="100" placeholder="Place for your thoughts"></textarea>
</form>
Radio checkboxes should follow the following style guideline:
<form class="form">
<fieldset>
<label class="form__label">Do you like our Styleguide ?</label>
<input type="radio" id="likes_it" name="voting" class="form__checkbox--radio" value="awesome">
<label for="likes_it">Yes, awesome!</label>
<input type="radio" id="medium_like" name="voting" class="form__checkbox--radio" value="medium">
<label for="medium_like">It's decent</label>
<input type="radio" id="ugly_af" name="voting" class="form__checkbox--radio" value="ugly">
<label for="ugly_af">No! disgusting</label>
</fieldset>
</form>
<form class="form">
<label for="select" class="form__label">Select Field:
<select class="form__select">
<option disabled selected>choose</option>
<option value="small">Dabilu Shoes</option>
<option value="medium">Dabilu Shirts</option>
<option value="large">Dabilu Sneakers</option>
<option value="xxlarge">Dabilu Backpacks</option>
</select>
</form>
We differentiate between two different types of links.
In order to write the cleanest and most readable code possible we use mixins. Mixins are groups of styles that can be reused throughout our code. One of the features of mixins is that they can use blocks of content which is especially usefull for media-queries.
They should be written like this:
Create mixins in order to be able to use named nested media queries:
$tablet-width: 768px;
$desktop-width: 1024px;
@mixin tablet {
@media (min-width: #{$tablet-width}) and (max-width: #{$desktop-width - 1px}) {
@content;
}
}
@mixin desktop {
@media (min-width: #{$desktop-width}) {
@content;
}
}
Use mixins as named nested media queries like that:
p {
font-size: 16px;
@include tablet {
font-size: 18px;
}
@include desktop {
font-size: 20px;
}
}