Default Stylesheets
Use the provided “mywsb-dev.css” stylesheet.
Styling Content
Your goal is not to recreate the printed version of a publication. Rather, your goal is a clean, well-formed, and usable digital product. Therefore, avoid adjusting styles wherever possible.
The inclusion of the Tachyons framework in our stylesheet allows you to adjust content formatting as needed without having to write CSS. Consult the CSS Library for more information.
Avoid adding writing CSS unless absolutely necessary.
CSS Validity
Use valid CSS. Using valid CSS is a measurable baseline quality attribute that ensures proper CSS usage and team consistency.
Type Selectors
Avoid qualifying ID and class names with type selectors. Avoiding unnecessary ancestor selectors is useful for performance reasons.
It is also bad practice to use IDs as selectors in your CSS files.
/* Recommended */ |
Attribute Selectors
In contrast to the above section, using types with attribute selectors is good practice because unqualified attribute selectors are known to be slow.
Therefore, always qualify attribute selectors with types.
/* Recommended */ |
Shorthand Properties
Use shorthand properties where possible.
CSS offers a variety of shorthand properties (like font
) that should be used whenever possible, even in cases where only one value is explicitly set.
Using shorthand properties is useful for code efficiency and understandability.
Note that in the following snippet, the two declaration blocks set the same properties!
/* Recommended */ |
0 and Units
Omit unit specification after “0” values.
Do not use units after 0 values unless they are required.
/* Recommended */ |
Leading 0s
Include leading 0s in decimal values for readability.
/* Recommended */ |
Hexadecimal Notation
Use 3 character hexadecimal notation where possible.
For color values that permit it, 3 character hexadecimal notation is shorter and more succinct.
/* Recommended */ |
CSS Font Declarations
Any font added to the font
directory should be referenced in the CSS.
@font-face { |
When exporting from Indesign, the format is not included and should be added.
Find: |
If a font comes in italic it should be included with a font style of italic
and oblique
:
@font-face { |