wordpress添加媒体_如何在WordPress中添加单行/双行间距

wordpress添加媒体

Do you want to add single / double line spacing in WordPress? In most Word processors, you can easily add extra blank line space by pressing the enter key a few times. You can also create double spaced line after paragraphs from the formatting options. However, WordPress visual editor doesn’t have those buttons. In this article, we will show you how to easily add single / double line spacing in WordPress.

是否要在WordPress中添加单行/双行间距? 在大多数字处理器中,您可以通过几次按Enter键来轻松添加额外的空白行。 您还可以从格式选项在段落之后创建双倍行距。 但是,WordPress可视编辑器没有这些按钮。 在本文中,我们将向您展示如何在WordPress中轻松添加单行/双行间距。

Adding single or double line spacing in WordPress

Before we start, it’s important to know that line spacing is controlled by the WordPress theme you use. We will show you how to add line spacing in the visual editor, and then we will cover how to change the line spacing in your theme if you’re not happy with the results.

在开始之前,重要的是要知道行距是由您使用的WordPress主题控制的。 我们将向您展示如何在视觉编辑器中添加行距,然后介绍如果您对结果不满意的话如何更改主题中的行距。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

添加双行空间 (Adding Double Line Space)

When you press the ‘Enter’ key on your keyboard to add a line break, WordPress visual editor considers it as a new paragraph. This means that it will automatically add double line space granted that your theme has the styling for it (all good WordPress themes do).

当您按下键盘上的“ Enter”键以添加换行符时,WordPress 可视化编辑器会将其视为新段落。 这意味着它会自动添加双行空间,前提是您的主题具有样式(所有好的WordPress主题都可以)。

So simply go in and press Enter after the line and then type something else in the next line.

因此,只需进入并在该行之后按Enter,然后在下一行中输入其他内容即可。

Adding double line spacing in WordPress

By simply doing that, based on your theme styling, you should see a clear distinction between paragraphs (i.e double line spacing).

通过简单地这样做,根据您的主题样式,您应该看到段落之间的明显区别(即双行间距)。

Double line space added to create paragraph in WordPress
添加单行空间 (Adding Single Line Space)

Now if you are writing something like an address, then you probably want it to be single spaced instead of double spaced.

现在,如果您正在编写类似地址的内容,那么您可能希望它是单行而不是双行。

Single Space Preview

In this case, you need to press SHIFT + ENTER key.

在这种情况下,您需要按SHIFT + ENTER键。

This will tell WordPress that you want to start a new line inside an existing paragraph thus it needs single line spacing vs double line spacing.

这将告诉WordPress您想在现有段落内开始新行,因此它需要单行间距与双行间距。

修改线高和间距 (Modifying the Line height and Spacing)

Sometimes even when you add the proper line spacing in the editor, it doesn’t display the way you want it to in your theme. This is when you need to add some CSS to your theme.

有时,即使您在编辑器中添加了适当的行距,它也不会显示您想要的主题间距。 这是您需要在主题中添加一些CSS的时候。

CSS is basically like the formatting feature in Microsoft Word. Instead of clicking buttons, you will be writing some plain CSS code. It is not as scary as some beginners may think. CSS is very easy to understand if you are just following instructions.

CSS基本上类似于Microsoft Word中的格式设置功能。 您将不用编写按钮即可编写一些简单CSS代码。 它并不像某些初学者想象的那样可怕。 如果您仅遵循说明,那么CSS非常容易理解。

To add custom CSS to your theme, you need to visit Appearance » Customize page. This will launch the WordPress theme customizer where you need to click on the ‘Additional CSS’ tab from the left column.

要将自定义CSS添加到主题中,您需要访问外观»自定义页面。 这将启动WordPress主题定制器,您需要在其中单击左栏中的“其他CSS”选项卡。

Adding your custom CSS

In the custom CSS box you need to add the following CSS code:

在自定义CSS框中,您需要添加以下CSS代码:


.post p{line-height: 1.5em;} 

Adding custom CSS to increase line height

The CSS rule shown above will change the line spacing of paragraph content to 1.5em. Em is a unit of width for typography. We are using .post class which WordPress automatically adds to the content area of all posts to make sure it only affects posts and not paragraphs used elsewhere.

上面显示CSS规则会将段落内容的行距更改为1.5em。 Em是印刷字体的宽度单位。 我们使用的是.post类,WordPress会自动将其添加到所有帖子的内容区域,以确保它仅影响帖子,而不影响其他地方使用的段落。

Now this only changes the spacing of single spacing. If you want to change the spacing between each paragraph (i.e double spacing), then you would need to add padding.

现在,这仅更改单个间距的间距。 如果要更改每个段落之间的间距(即双倍间距),则需要添加填充。


.post p { 
line-height: 1.5em;
padding-bottom: 15px;
} 

Feel free to adjust the numbers to meet your needs.

随意调整数字以满足您的需求。

We hope this article helped you add single / double line spacing in WordPress. You may also want to see our tips on mastering the WordPress visual editor to write content more efficiently in WordPress.

我们希望本文能帮助您在WordPress中添加单行/双行间距。 您可能还想查看有关掌握WordPress可视编辑器以在WordPress中更有效地编写内容的提示

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/beginners-guide/how-to-add-single-double-line-spacing-in-wordpress/

wordpress添加媒体

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值