简体   繁体   English

如何找到空白并将其删除PhpStorm?

[英]How to find whitespaces and remove them PhpStorm?

Based on this question I have a new question. 基于这个问题,我有一个新问题。 I'm using PhpStorm to create my php files and my markup looks like this: 我正在使用PhpStorm创建我的php文件,我的标记如下所示:

<div>
     <div>
     </div>
</div>

The different spacing is made automatically when pressing enter. 按Enter键时,将自动创建不同的间距。 But recently I had a new problem (see link above). 但是最近我遇到了一个新问题(请参见上面的链接)。 I had whitespaces which I couldn't delete the only way that worked was not using a new line with a tab like: 我有空格,无法删除的唯一方法是不使用带有选项卡的新行,例如:

<div><div>
</div>
</div>

I tried to remove it by selecting the text between the divs like: 我试图通过选择div之间的文本来删除它,例如:

在此处输入图片说明

and then pressing enter. 然后按Enter。 The result after: (note: I didn't add a tab its added automatically): 之后的结果:(注意:我没有添加标签页,它是自动添加的):

在此处输入图片说明

But why is this code containing whitespaces? 但是为什么此代码包含空格? I never had problems with it before. 我以前从未遇到过问题。

(please view the linked question to see the problem it creates, didn't add it here to make the question more readable) (请查看链接的问题以查看其创建的问题,未在此处添加它以使问题更易读)

In HTML, all whitespace (including tabs, new lines, and regular spaces) is treated the same. 在HTML中,所有空格(包括制表符,换行和常规空格)都被视为相同。 If you need to eliminate all spaces, deleted the new line inside the inner <div> . 如果需要消除所有空格,请删除内部<div>的新行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM