What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

How do I do a single newline/carriage return when typing a question or answer on the Stack Overflow website?

For example, if I wanted to write some columns with values as in an Excel spreadsheet. I see people do it all the time, but I don't know how. I read the formatting tips and all about the blockquote stuff... did some google'ing, but I still haven't found out how.

The only way I know to do newlines is by pressing the Enter key twice, which makes a new paragraph, creating an empty line, which is not what I want.

share|improve this question

migrated from stackoverflow.com Jul 5 '12 at 15:46

This question came from our site for professional and enthusiast programmers.

Did you already try <br/> like in HTML? – TimVK Jun 20 '12 at 12:27
Thanks Tim. <br/> works ! I didn't think of that one. I can use shift+enter here for newlines, but when asking a question or answering one I have to use <br/> tags. Okay. got it. edit: You can put that solution in as an answer so it can be voted on. Respectfully, Josh – joshpt Jun 20 '12 at 12:33
I find that sometimes <br> is needed too, depending on the situation – joshpt Jun 20 '12 at 12:42
So it looks like that meta part of the site deals with questions pertaining to mechanics of the stackoverflow site itself. Please correct me if it is anything different or anything more. – joshpt Jun 21 '12 at 19:47
Beware of the small screens, where such tables do not have scrollbars but are wrapped. – Arjan Jul 5 '12 at 16:51
Related: balpha wrote a long answer to a related question explaining why the two-line rule exists. – Pops Sep 20 '12 at 17:28
hit Spacebar twice. then Enter – Arpit Rawat Sep 20 '12 at 17:59
As u useful comment was wiped when other answers to this question were deleted, let me repeat one very good reason not to use <br>: <br/> creates formatting messes later for someone trying to go back and edit to clean up other things (say, by applying a <pre> tag -- suddenly all that markup is visible), and it's the harder way to do this anyway. – Joel Coehoorn♦ Jul 5 '12 at 16:05 – Arjan Aug 17 '13 at 8:24

1 Answer 1

up vote 20 down vote accepted

You can type two spaces followed by Enter key (which will give you a single newline character).
Like so.

I wanted to write some columns with values as in an Excel spreadsheet

For longer/pasted text, you can also format as code in many ways, like by indenting with 4 spaces, or by using <pre></pre> tags (which need manual encoding of HTML), like so:

Column 1   Column 2   Column 3
value 1      13            26
value 2      11            22
share|improve this answer
But as an aside: line breaks should not be confused with (or abused for) paragraphs. – Arjan Jul 25 '12 at 9:34
@gobernador, Why not use <br> instead? – Pacerier Apr 5 at 11:29
Is that useful? of no use – kdh Apr 30 at 5:40
@kdh, I mean typing <br> instead of typing "space" + "space" + "newline". Try it, it works. – Pacerier Jul 15 at 1:42
@Pacerier as Pops said in a comment to a now deleted answer, "Markdown should be preferred over HTML" - which makes sense. Raw HTML should be used with care and only when there's no Markdown alternative. – Shadow Wizard Jul 15 at 7:30
@ShadowWizard, That's true only if a future CSS template might display them differently. However, <br> and "space" + "space" + "newline" are synonymous regardless of styling. – Pacerier Aug 5 at 9:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .