4. Why
Client: the white-space on the news
overview page is wrong!
body #page .view-news .views-row
div.node .node-section.clear-block {
margin-top: 0 !important;
}
4
5. Agenda
‣ Drupal is special
‣ Optimize your design input
‣ Optimize your Drupal HTML
‣ Write maintainable CSS
‣ Build a maintainable theme
5
10. Problems with designs
‣ A design is static
‣ Not all pages will be designed
‣ Designs are rarely consistent
‣ A design reflects the ideal situation
10
11. Solutions
‣ Ask for a Style Guide
‣ Analyze the design
‣ Keep designers involved
11
12. Style Guide
‣ All recurring design elements and
interactions
‣ Leading in case of inconsistencies.
12
13. Style Guide
‣ Site elements:
‣ Navigations: including mouse-over and active
states
‣ One or more block templates
‣ A pager
‣ Message boxes: warning, confirmation and error
‣ A form. Typically useful for the contact form
‣ A list of the most important colors
13
14. Style Guide
‣ Typography:
‣ Headings: H1, H2, H3 and H4
‣ Links: color and (optional) underline. Also define
a mouse-over state
‣ Paragraph: for default text the line-height and
space between text should be defined
‣ (Un)ordered list: How does it look in content?
14
15. Analyze the design
‣ Print all designs
‣ Look for patterns:
‣ Block styles
‣ Image styles
‣ View Modes
‣ Regions...
‣ Convert patterns to HTML tags/classes/styles
15
24. Functional selectors
‣ Theme a functional element, not a
Drupal module:
‣ Bad:
‣ .views-articles .views-row {}
‣ .views-row {}
‣ Good:
‣ .article-teaser {}
‣ .item-list li {}
24
25. As generic as possible
.field
vs
.page-article #content div.node
div.field-title
25
26. Avoid overwrites
‣ Remove Drupal and module CSS
‣ function theme_css_alter(&$css) {
unset($css['modules/system/system.menus.css']);
}
‣ Dare to rework existing CSS as
features are added.
26
37. In Summary
Client: the white-space on the news
overview page is wrong!
body #page .view-news .views-row
div.node .node-section.clear-block {
margin-top: 0 !important;
}
37
38. Power of Sass
.node-news {
.view-mode-teaser {
@extend %teaser;
color: $grey;
@include border-radius(3px);
margin-top: 0;
}
}
38
39. In Summary
‣ Drupal is special
‣ Optimize your design input
‣ Optimize your Drupal HTML
‣ Write maintainable CSS
‣ Build a maintainable theme
39