CSS variables, colors and fonts
Get overview of what CSS variables that are provided by the writer. Also get a good overview of fonts and colors.
CSS
Naming
We uses BEM as method for naming CSS classes.
A BEM class name includes up to three parts.
Block: The outermost parent element of the component is defined as the block.
Element: Inside of the component may be one or more children called elements.
Modifier: Either a block or element may have a variation signified by a modifier.
If all three are used in a name it would look something like this:
[block]__[element]--[modifier]
Further reading:
CSS variables
General
For using CSS variable you use it with var(--NAME-OF-VARAIBLE)
for example if we to use one of our color variables it could look like this color: var(--dw-color-primary)
. It will pick out the defined color by the Writer so we can easily update this in the future without going over plugins.
Available variables
CSS variable name | Description |
--dw-body-color | Body color for the Writer |
--dw-link-color | Link color. Shouldn't be use to fallback to Writer |
--dw-border-radius | Default border radius in content area |
--dw-image-border-radius | Default image border radius |
Fonts | |
--dw-font-family-base | Default font-family |
--dw-font-family-sans-serif | Default sans-serif font. Same as --dw-font-family-base |
--dw-font-family-serif | Default serif font. |
--dw-font-size | Default Writer font-size |
--dw-line-height-base | Default Writer line-height |
Forms | |
--dw-input-font-size | Default input font-size |
--dw-input-color | Default input text color |
--dw-input-color-placeholder | Default placeholder text color |
--dw-input-padding-x | Default input x padding |
--dw-input-padding-y | Default input y padding |
Color variables
Every CSS color variable starts with the prefix --dw-color-.
General you will just use default color for each predefined color for the Writer and that will be easiest just to use prefix with the name and you will get the default color. For example --dw-color-primary
or --dw-color-alert
. That is the same as --dw-color-primary-500
or --dw-color-alert-500
. Default colors are marked with *.
If you will work with a color in most cases it's enough to work with 100, 300, 500 (default) and 800 to get right feeling.
In color scheme under you can see what text color you have to use together with a specific background color to get correct contrast.
Utility classes
The Writer provides utilises/helper classes for faster developing but mainly for standardised appearance.
General
.dw-shadow-box
With this class you will apply standard styles for how a shadow box should look in the Writer. This for not getting hundreds different looks for shadows.
Example:
.dw-shadow-border-{COLOR}-{SIZE}
This is created for easy mark up object. In the first case to mark up content parts as restricted. We wanted a standardised this so we easily can changed later on if we wanted.
You can use this we the whole color scheme naming.
Example:
Forms
.dw-form-group
Wrapping class for label and input standardised style
.dw-form-control
Applies to input and textarea for standardised style
.dw-form-group-inline-label
Uses together with .dw-form-group
to wrap input and label to get label presentation inside input element for a hint.
Blocknodes
A blocknode is represented in the content area often append by a plugin. For example image-plugin, Youtubeembed-plugin and so on.
We have created classes for faster get a unit style. You should following classes together on same object.
<div class="dw-blocknode dw-blocknode--gray dw-blocknode--focus-transparent"></div>
.dw-blocknode
Head class that will add specific display property full width and standard padding to the blocknode.
.dw-blocknode--no-padding
Remove standard padding is for you will have a edge to edge presentation
.dw-blocknode--gray
Some element in the content area att presented with a gray background for mark is placement but not take up to much of the attention.. Use this class to get correct color.
.dw-blocknode--focus-transparent
If you use .dw-blocknode--gray
you can use this class to get normal focus state when node is focused or selected.
.dw-blocknode--border-radius
Get standard border-radius applied to block node.
Classes to be used inside dw-blocknode
.dw-blocknode__header
Get standard united style for your header. Adds correct margin to icon if you prepend one.
.dw-blocknode__content
Last updated