简体   繁体   中英

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:

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

The different spacing is made automatically when pressing 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:

在此处输入图片说明

and then pressing 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. If you need to eliminate all spaces, deleted the new line inside the inner <div> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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