-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Gutenberg baseline font size? #11043
Comments
Apologies if this is a silly question, where exactly are you adding that CSS snippet? |
In my theme. For example, Twenty Fifteen does this, too: |
I have the same issue. My custom theme sets the following:
These effectively cancel each other out, but allow me to easily calculate rem values from px, whilst respecting a user's browser font-size choice if it's set (less common these days with zoom, but if the user sets it, it should be respected) I'm using the following to enqueue editor styles (which include the above rules):
This results in all editor text being too large - so I assume the editor is ignoring the :root rule. Is there a style rule I can apply to make this work? I've tried various, including |
Temporarily hacked around this by adding the following to my
Feels like this shouldn't be necessary though... |
The reason |
In terms of setting a font size in the default themes, I got curious as to what Twenty Nineteen does and I found this:
Source: https://s2.wp.com/_static/??/wp-content/themes/pub/twentynineteen/style.css But that may not be the whole story because they also have added theme support for I am not 100% sure it's what you need, so you might need to experiment a little. Have you tried adjusting the default set of font sizes using theme support for |
I don't know of anything that can be done on the WP side to help out with this. WP doesn't assign a font-size on the html element in the admin, so any value that you give it should work for your The issue you all may be having is that your using the My advice: You should still take advantage of the My long-term advice: Stop doing this. Retrain your brain for relative sizing units. 😃 |
I decided to scrap the http://www.standardista.com/px-to-rem-conversion-if-root-font-size-is-16px/ |
Thanks @m-e-h, @designsimply - adding root styles via @m-e-h thanks for your advice re. using a base 10 for rem units 😃 I'm interested in what the rational is.... I've used the normal base 16 for years, and just switched to base 10 and love it! I'm working solo on custom theme development, so generally speaking it's only me working on the code. I know I can use a sass mixin to convert px > rem, but it's just slightly more typing/slightly harder to scan - particularly when using rem for margin, padding, borders etc as well as typography. |
I've just created a node cli to fix this. It does replace all rem values in the editor-style.css so you can still keep using rem's in your theme stylesheet. |
I'm trying to add Gutenberg support to one of my themes. My theme sets a font size percentage on the root:
And this allows me to work with rem units in an understandable way since 1rem is essentially equal to 10px. But this is not working to set font sizes in Gutenberg blocks because I don't know which baseline font size the Gutenberg editor is using.
Any ideas?
The text was updated successfully, but these errors were encountered: