Codepen.io editor question

Codepen.io editor question
0

#1

When I’m editing my code for the tribute page, I’m getting a weird issue.

When I press enter after a line of code, codepen adds 2 lines of spaces. I can delete these spaces, but that seems like a waste of time. I just want the cursor to move down one line.


#2

I’m glad you asked this. It does the same thing to me. Hoping someone knows the answer…


#3

The spaces are added to keep the code formatted properly. Though it may not be needed, it keeps it organized and looking nice. In codepen at the top of each window there is a dropdown arrow. Click this and hit tidy and will re-organize your code too. If for some reason you dont want spaces before your code (aka unreadable), just type it up in Notepad and copy-paste into codepen once done.

This is hard to read:

//html
<div blah blah>
<h1>blah blah</h1>
</div>

//css
* {
rule: none;
}

//js
var nothing;
if (nothing === null) {
nothing = true;
}

This is properly formatted with two or four spaces. Codepen is nice and adds them automatically for you, there is no reason to delete them!

//html
<div blah blah>
  <h1>blah blah</h1>
</div>

//css
* {
  rule: none;
}

//js
var nothing;
if (nothing === null) {
  nothing = true;
}