wordpress字体_如何在WordPress中轻松更改字体大小

使用CSS更改站点范围内的字体大小

If you are changing font sizes every time you edit a post, then you may want to make it easier by changing it permanently in your theme.

如果您每次编辑帖子时都在更改字体大小,则可能需要通过在主题中进行永久更改来使其更容易。

The good news is that you can change the default paragraph size across your whole site. The best way to do this is by using the Theme Customizer under Appearance » Customize.

好消息是您可以更改整个网站的默认段落大小。 最好的方法是使用外观»个性化下的主题 个性化 。

Some WordPress themes may come with an option for you to change the font size. If you can find this option, then you can use it without writing CSS code.

某些WordPress主题可能会附带一个选项,您可以更改字体大小。 如果可以找到此选项,则无需编写CSS代码即可使用它。

However, if your theme does not have that feature, then you can add custom CSS to add your own font size rules.

但是,如果主题不具有该功能,则可以添加自定义CSS来添加自己的字体大小规则。

Simply click on the ‘Additional CSS’ option in the theme customizer. This is where you can store all your custom CSS code.

只需在主题定制器中单击“其他CSS”选项。 您可以在此处存储所有自定义CSS代码。

Using the Customizer to add CSS code to your site
Now under the additional CSS text box, simply add your CSS code. In this example, we are changing the font size to ’16px’, you can choose a different font size.

现在,在其他CSS文本框下,只需添加您CSS代码。 在此示例中,我们将字体大小更改为“ 16px”,您可以选择其他字体大小。

You’ll immediately see the changes on the preview on the right-hand side of the screen. If you’re happy with the font size, click the ‘Publish’ button at the top of your screen to make it live.

您将立即在屏幕右侧的预览中看到更改。 如果您对字体大小感到满意,请单击屏幕顶部的“发布”按钮以使其生效。

Note: Your custom CSS will only be applied to the theme you’re using. If you later choose to switch to a different WordPress theme, you’ll need to copy and paste it into the Customizer again.

注意:您的自定义CSS只会应用于您正在使用的主题。 如果以后选择切换到其他WordPress主题 ,则需要再次将其复制并粘贴到定制程序中。

The above code only applies to paragraph text. What if you wanted to change the font size of all h2 sub-headings?

上面的代码仅适用于段落文本。 如果要更改所有h2子标题的字体大小怎么办?

Simply modify the above code to target the h2 element in your theme like this:

只需修改上面的代码即可将主题中的h2元素作为目标,如下所示:

You can do the same thing with other headings as well by simply changing h2 to h3, h4, or h5.

通过将h2更改为h3,h4或h5,您也可以对其他标题执行相同的操作。

Author: 睽睽

发表评论