如何在网站上更改字体

:loudspeaker: Update 01/2019 The obsolete guide referred to in this post has been updated and is fully functional :loudspeaker:

Continuing the discussion from How to change default font:

  1. Per instructions for the admin panel - I’m not finding any CSS or HTML or font settings that seem to be related to the default font.

Is there still a setting for it?

  1. Also - what was the default font that was being used prior to the most recent update?

I’d like to switch back to it if possible.
I was super happy with that one.
(This new wider feels stretched out and weird.)

  1. And I’m noticing different browsers are doing different sizings with it. (it was consistent before).
    So if there’s a setting for that, please direct me there as well.

(Opera Win, Firefox Unix, Firefox Win, Chromium Unix)

thanks so much!

2 个赞

We should fix the linked topic by editing it to be up to date and deleting old / irrelevant posts @dax.

4 个赞

Before answering your questions, I’ll let you know that we’ve just introduced a new setting on the user profile called Text Size. Each user from now on will be able to enlarge or reduce the character of the site as prefer. See your for example your profile https://meta.discourse.org/u/MichelleBasey/preferences/interface

We have made a lot of changes since 2014 … Now you have to choose “where” you want to make changes, only on Desktop, only on Mobile or in Common(both Desktop and Mobile) and then choose what to change, in your case the CSS tab to change the size of the font. If you need to change the font itself you can still use the @import url(); and the link rel="stylesheet" href="#"> mode, but it is easier to upload the font directly in the site assets following this guide Include assets (e.g. images, fonts) in themes and components.

The font is always the same, Helvetica (Arial,sans-serif). We only bump up the size 1px.

This depends on the different browsers not by us, each browser is set differently, you should visit the various settings of each browser to make the font the same size (at least).

5 个赞

Hmmm, when I go to the Admin panel, and type “css” or “mobile” in the search, there aren’t any settings related fonts.

I’m a trial user aiming for the basic plan where all the smart kids take care of the backend and I’m free from @import’ing things, so I don’t know where or how any CSS edits would be taking place.

(I believe all of that is being done on your server and I’m just redirecting there with my website with no uber-geek power to tweak the actual CSS file.)

Something changed with the latest update. I’ll play with the settings in my user profile and see if I simply need to adjust the new feature.

Something changed with the latest update. My browser settings have been the same - the defaults that came with them (in regards to fonts.)

And since it’s 4 browsers across 2 operating systems, it was causing me to think there was something on the Discourse side that had shifted.

Thanks for your help and all the detailed data!

Sounds like it’s as simple as altering personal profiles.

There isn’t a physical CSS file to edit, files are generated based on how you configure your site. Look at /admin/customize/themes - each theme CSS is modifiable there.

The 1px increase from 14px to 15px was to achieve parity with mobile. For certain screen resolutions and browsers it may impact how text is rendered, but I can assure you that the font itself did not change and hasn’t in many years.

4 个赞

That original guide has been fixed and has been moved to the FAQ category

3 个赞

我按照 Change the default font on your site 中的说明尝试了(同时使用了 CSS 和 HTML 方法),但发现只有在点击预览按钮时字体才会真正改变。这是在多次尝试和摸索之后才得出的结论。

这非常奇怪——难道只是我缺乏耐心吗?我不太容易在其他实例中测试,不过目前我们已经解决了这个问题,但我不希望其他人也经历同样的困扰。

我们有一个主题组件,让更改字体变得非常简单。

7 个赞

这太棒了,而且简单多了!!

你觉得是否应该修改常见问题解答(FAQ),以突出主题组件?

字体选择将成为设置向导的一部分。@neil 负责本版本中的此项工作,优先级为低至中等。目前还有其他一些任务排在前面。

3 个赞