t1
though.)
w
in
w-16
are indeed functions, accepting arguments. The CSS is actually generated by calling these utility
functions and passing them the provided arguments.
Turbo CSS | JavaScript analog |
---|---|
w-16
|
w(16)
|
w-12.34567
|
w(12.34567)
|
color-red
|
color('red')
|
bg-c-blue
to make the background blue on mobile.
All the bigger screen sizes will use this setting, unless you override them at larger breakpoints.
For example, to make it red on screens at least 640px wide, use the
w6:bg-c-red
class. The
w6:
responsive selector defines that this setting shall only apply to screens above 640px.
w6:
for 640px and above,w7:
for 768px and above,w10:
for 1024px and above,w12:
for 1280px and above.hover:
focus:
active:
visited:
empty:
not-empty:
even:
odd:
first:
not-first:
last:
not-last:
valid:
invalid:
enabled:
disabled:
checked:
unchecked:
hoverable:
not-hoverable:
screen:
print:
and
speech:
.
w6:hover:bg-c-red-700
class to provide different hover effects on different screen sizes.
(Resize the demo!)
placeholder:
selection:
before:
after:
and
thumb:
pseudo selectors.
/
, you could change an element's background color if its parent is hovered.
+
, you could change an element's background color if its previous-sibling is hovered.
hover://bg-c-blue
will only apply if the element's grand-parent is hovered.
This may sound exotic at first, but if you are going to use Turbo, trust me, you are going to use combinators a lot.
They open up a whole new world.
btn-m
class for a medium sized button.
Now, I want to show it on desktop only, because on mobile, I want
to show a large button
btn-l
.
Thus, what I want to write is
btn-l w10:btn-m
,
where
w10:
makes it only apply to large screens.
btn-m
class is not necessarily a single class. It may have a hover state defined,
may have various definitions for different screen sizes,
styles applied to the
::before
pseudo element, etc..
btn
class:
btn
class in the
example
library, you will reference it via
example.btn
.
When loading it into the global scope, you would simply use the
btn
class on its own.
t1
class, it has many purposes.
One of them is namespacing. All generated classes include the
t1
namespace class, thus if your project is not using it, you can use Turbo on your project
without accidentally breaking anything.
(I haven't found any CSS framework that is using it.)
p-16
could become
NAMESPACE-p-16
.
For avoidance of doubt, the namespace is automatically injected, you would not write it yourself.
t1
class is used to apply the base styles to every element, one-by-one.
t1-all
class that lets you apply the reset to the entire subtree of an element, if you choose to.
Adding it to the HTML element would be akin to using a global CSS reset.
t1
class for that purpose.
Instead, there is a
t1-start
class which you should use once at the root of any subtree controlled by Turbo CSS.
22kB
minified gzipped.
@
self selector used by Turbo. We will have to do more explicit testing on that.