Such is also the case with me. It is purely a personal habit. Moreover, in this case, there will be much fewer carriage returns and spaces, which saves the need for slimming. In addition, this writing method can quickly find a selector (you don't need to turn over many pages to find it), which improves efficiency.
In fact, it is enough to write all the contents in one line, but it will be more troublesome to modify (I mean to modify it directly with a text editor like Notepad, and if it is a web designer like DW, it will automatically format the code). The advantage is that it is equivalent to a little encryption.