-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Custom units #174
Comments
Part of of #163 |
People often use a css variable to store a custom unit, and then multiply from it to have units relative to that like this: |
Thanks @ericvida - I pushed a first draft based on your feedback. Custom UnitsYou can define your own unit that can be used for styling and calculations. The unit can have modifiers like break points and you can use the units in the same way as other css units. The syntax to define a custom unit is global css @root
1pad: 25px
1col: calc(100vw / 12)
tag app-dialog
css
width: 12col @md: 6col lg: 3col
p: 1pad |
@Pistus this is a great example. Very smart use of custom units. The only thing is that when I use |
Made another educated guess start of documenting custom units. Would be great to know if this is anywhere close @somebee 🔍 The example can be made simpler, but not sure what the best selling points of custom units are yet.
Custom Units
You can define your own custom numerical unit that can be used for styling and calculations. You define a custom unit by using a css property starting with a number (measure) and then the unit name. For example 1t: . The unit can have modifiers like break points and you can use the units in the same way as native numerical units like px and em.
Here is an example defining
t
andw
as units:The text was updated successfully, but these errors were encountered: