Comments (4)
No — the API is focused on providing high-level controls over your typography e.g. changing the baseFontSize
doesn't just change the body font size but it also changes the baseLineHeight which changes the size of our rhythm
unit which then changes the spacing between dozens of elements.
Changing the letter spacing just changes the letter spacing. So for styles that don't have cross-cutting effects, I just use css. I do like to control styles like this with Typography.js. For my sites I have a utils/typography.js
in which all global styles go. For changes like letter-spacing, see the overrideStyles
API option. You can pass a function in and set arbitrary CSS. This gets called after the rest of the CSS is generated so you can add additional rules or override defaults.
from typography.js.
And a fwiw, I don't like using letter-spacing. If you want a narrower or wider letter spacing, I'd rather choose a different typeface which is more narrow. Just like you'd much rather use a real italic instead of browser's emulated italic. A number of larger font families will also include a narrow or condensed version as well.
from typography.js.
Thanks.
Agreed on the letter-spacing as a fallback option. I mostly use it out of necessity when finding a similar font that's narrower/wider isn't viable given constraints.
from typography.js.
@KyleAMathews can i see an example of how you include global styles inside your utils/typography.js
Im looking to add letter spacing to all my headers and am curious how you approached this as im just using a standard css file to for all h1,h2,etc
Also if you have a link to a blog/tutorial on how to use the overrideStyles id much appreciate it TY.
from typography.js.
Related Issues (20)
- Edge browser <p> margin-bottom overrides <p> margin: 0
- Why force text-align="left" on tables? HOT 2
- Add custom scoping
- How do I override linkColor? HOT 3
- Ocean Beach theme is missing a dependency
- either overriding styles is unintuitive and under-documented or I need help
- Adding my site in the list of projects using typography.js?
- Injecting CSS reset before typography.js styles in Gatsby? HOT 2
- Google Fonts are not loaded HOT 1
- Difference between demo website and usage themes HOT 3
- Which UI Kit plays nice with Typographyjs?
- Implementing pre-fetching for Google fonts
- Adding display=swap to GoogleFont in react-typography
- Fonts only seem to work if I have them installed locally HOT 1
- Heading line-heights not the same as paragraphs?
- Chromium doesn't load fonts
- Gatsby 3.0 Dependency Error HOT 2
- Update to support React 18 HOT 4
- Support CSS variables HOT 2
- Shoelace tokens based typography
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typography.js.