Component styles
Writing Typetura keyframes
Typetura styles are stored in CSS keyframes. Keyframe 0%
is equal to a context with of 0px
and keyframe 100%
is equal to a context width of 1600px
. Styles within each keyframe can be written as if you were styling an element.
You can add as many keyframes as you want, using any animatable CSS property.
Add as many keyframes as you wish. It is recommended that you use both a 0%
and 100%
keyframe. If you do not use 0%
and 100%
keyframes, those will default to your element styles.
Applying Typetura keyframes to an element
Now that we have our basic keyframes set up, they need to be attached to an element with the --tt-key
property. These will overwrite any other layout styles so you should treat this as progressive enhancement.
Changing the maximum width
If 1600px is not the maximum width you want to style for, you can change it with --tt-max
. For example, if you want the keyframe 100%
to be located at 960px
, then write --tt-max: 960;
on your context.
Transition easing
By default, Typetura uses linear easing. This means the transitions are directly proportional to the context changing. However, there are times when you want the transitions to happen slower or faster during portions of the element scaling. Easing functions enable this to happen. Apply custom easing using the --tt-ease
property.
These custom easing curves enable you to have more control over how text scales across context changes, and can reduce the number of keyframes you need.
Overwriting styles
Keyframes always overwrite element styles, even when using an !important
flag. You can overwrite styles by assigning them new keyframes or removing the keyframes.
Removing Typetura keyframes
If you want to remove keyframes attached to a selector, use --tt-key: none;
.
Assigning new Typetura keyframes
Point --tt-key
to a new set of keyframes you created.
Best practices
At this point you know the basics of Typetura. If you want to get deeper into the best practices for applying this technology, go to the link below.
Our Keyframe editor
If you want a way to visualize the styles you are producing, you can check out our keyframe editor. It allows you to quickly and visually build intrinsic typographic systems.
Getting help and support creating new components
We are here to help! Get the most out of your typographic components by partnering with us.
Last updated