CSS Framework Research Notes
Frameworks considered
- Foundation -Â http://foundation.zurb.com/
- Bootstrap (Twitter) -Â https://dev.twitter.com/blog/bootstrap-twitter
- Pure (Yahoo!) -Â http://purecss.io/
- YAML -Â http://www.yaml.de/
- inuitcss -Â http://inuitcss.com/Â - a object oriented CSS framework, with little design.
Â
Â
Â
Feature / Desired application | Bootstrap | Foundation |
---|---|---|
Responsive layouts |
|
|
Style reset |
|
|
Units in EMs | Current release (v3) uses pixels and not EMs. However, v4 (unreleased) will support EMs. See Mark Otto's January 9th response in this thread on Github.
| Foundation 5 uses REM units throughout. The exception being media queries which use EM units.
|
Ease of using default styles in a heavily customized application |
|
|
Use of !important |
|
|
Namespacing framework classnames |
|
|
|
| |
Possible new Learner Prefs transformations with CSS Framework |
|
|
Example implementation of Fluidproject.org design | https://github.com/acheetham/fluidproject.org/tree/FLUID-5261 | https://github.com/jhung/fluidproject.org/tree/FLUID-5262 |
Â
Issue:Â REM sizes may not behave as intended if the root element has existing font-size
Description:
It is possible that the document in which an Infusion component is being added to already have a root font-size specified. In which case any REM sizes used in the Infusion component will size itself relative to that existing root font-size. If the font-size is not an expected value, the Infusion component may not look as expected.
Example:
Bootstrap specifies font-size: 62.5% on the HTML element, and a font-size: 14px to the Body element. Adding an Infusion component (which is using Foundation) with a font-size: 1rem to this document would have the Infusion component appear smaller since 1rem is relative to the 62.5% font-size value on the HTML element.
Conclusion:
This issue would occur if using Foundation in a Infusion component. To avoid this problem, Infusion's use of CSS framework should have a name space.
Issue: Without proper name spacing, it is difficult to mix two frameworks
Description:
If the integrator wants to customize an Infusion component using their own framework, style collisions may be unavoidable due to the use of generic classnames (like "row") or conflicting styles on HTML level elements (like "h1"). Therefore if Infusion's uses a CSS framework, it should be properly name spaced to ensure it doesn't get in the way of an integrator's customizations.
Discussion:
- it is possible to add a prefix to Bootstrap classnames by using a Python script:Â https://gist.github.com/macanderson/6128137
- here is a discussion about prefixing Foundation classnames:Â https://github.com/zurb/foundation/issues/546
Conclusion:
At this time, name spacing a CSS framework is not feasible. The common approach is to use a post processor (like Python) to add name space information, but this approach is fragile since new versions of the CSS framework may break the script.
Â
Appendix: Use Case Exploration
There are currently some unresolved user questions:
- What if a Fluid component is using a particular framework in its implementation, what are the consequences for an integrator?
- An integrator is using an existing framework, what happens if the Fluid component is using the same or different framework?
- In the case of the same framework, the component may be using a custom build or custom framework styles (over-ridden in css file) - what happens in this framework-framework interaction?
To explore answers to these questions, the following 4 use cases are possible:
To attempt to figure out the consequences of use cases 3 and 4, a custom version of Foundation (linked below) was created that is scoped to a mock Infusion component with the classname ".inf-foundation" on the container.Â
Evaluation of other CSS Frameworks (older versions)
 | Bootstrap 3.0 | Foundation 4 | Pure 0.3.0 | YAML 4 | Inuit 5 |
---|---|---|---|---|---|
Navigation Lists | Â | Â | Â | Â | Â |
Tabs | Implemented using Sections | Â | |||
Pills | Â | Â | Â | Â | |
Vertical lists | Implemented using Sections | Â | |||
Dropdowns | Â | Â | |||
Forms: Right aligned labels | Â | ||||
Anchor Buttons | No ARIA role | Â | |||
Normalize | see base.css | Â | |||
Clearfix | Â | Â | |||
Progressive Enhancement | Â | Â | Â | Â | |
Fixed height / Grid item layouts | Â | Â | |||
Progress Bars | No WAI-ARIA markup | No WAI-ARIA markup | Â | ||
Theming |
| Â | PureCSS Skin Builder | Â | Â |
Accessibility Features | .sr-only class makes element visible to ATs only .hidden and .show hide or show content. See below for notes on sr-only class | Â | Â |
See notes below. | Â |
Spacing unit | px | Â | Â | em | Â |
Environment | LESS | Sass | Straight CSS? | Sass | Sass |
Max Package Size* | 471,199 bytes | 1,028,053 bytes | 226,559 bytes | 1,196,192 bytes | Â |
License | Apache License v2.0 | MIT Open Source | BSD License | CC Attribution 2.0 | Apache License 2.0 |
Documentation | Friendly and thorough | Technical and thorough | Minimal, but complete. | Technical and thorough | Very minimal documentation. "There are no official docs for |
Community / Adoption | Active and widely adopted | Active and widely adopted | Active and widely adopted | ||
IE | Â | Â | Â | Â | Â |
6 | Unknown | basic experience, not broken. | Assume compatible due to Normalize.css | ||
7 | Â basic experience, not broken. | basic experience, not broken. | Â | Â | |
8 | Â basic experience, not broken. | not supported | Â | Â |
* Un-minified
The following is Bootstrap's CSS for .sr-only screen reader visible markup
Â
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
Â
Â
Â
Foundation:
Purecss:
- very minimal
- written in SMACSS
- Purecss is designed to play nice with other frameworks. One use case is to have Purecss as foundation and specific Bootstrap modules
- Not "version 1"
YAML
- YAML accessible text is to position the text off screen so it can get focus, but not visible on the screen.
.ym-skip, .ym-hideme, .ym-print { left: -32768px; position: absolute; top: -32768px; } .ym-skiplinks .ym-skip:focus, .ym-skiplinks .ym-skip:active { left: 32768px; outline: 0 none; position: absolute; width: 100%; } .ym-skip:focus, .ym-skip:active { top: 0; }
Â
LESS
A quick examination of LESS.
- LESS will give the ability of some conditional statements which control which CSS is rendered.
- Example: If screen is dark, then use light text.
- This is useful for our theming as it could replace inverted styles currently used in the preferences editor.
Â
Sass
A quick examination of SASS.
- In addition to mixins like in LESS, Sass has if, each, for loops like a proper programming language.