To <BR&gt or not to &lt;BR&gt, that is the question

One of the little things about a HTML editor is the way that block formatting works. Most users probably don't realize when they run into these kinds of problems, but they do.

The reason why editors have a hard time is because they are trying to emulate a word processor with some things. There are simularities between HTML and word processing documents - both have paragraphs, headings, bold, etc. But there are important differences as well. Forcing things too much into a mold with word processors can hurt you.

One thing that we got feedback about, and that I did not like myself, was that VS.NET 2003 always seemed to add <P> tags everywhere. Even if you have a document with just a body in it, if you press enter while in design view, you get a <P> tag. Delete everything, get a <P> tag if you didn't have one.

What I didn't like, and what a lot of other users didn't like, is that they got a <P> tag when they didn't ask for one. It makes sense to split a <P> tag if you actually have one and are inside of it. But if I have no <P> tag, adding one just so there is something to split seems to be thinking a bit too much.

So the way whidbey works is this: If you press enter inside any block format tag (other than DIV) then the block will split around where you pressed enter. If you press enter at the end of some of these tags (like the heading tags) then a new <P> will start.

If you press enter inside of a DIV, or a table cell, or the body, then we insert a <BR>. If you hold down shift+enter, you always get a <BR> no matter where you are.

If you really want a <P> tag, the format dropdown on the formatting toolbar will create one if you are inside of a non-block tag and you select <P> from the list.

I think that this design works better for most people. If you already have paragraph stuff we respect it and handle it. If you never use paragraph formatting we never put it there for you unless you explicitly ask for it.

Comments (10)
  1. Anonymous says:

    Thank god for that – somebody has finally had the sense to make the enter key allow me to enter text on a new line.

  2. Anonymous says:


    I would prefer if VS.Net didn’t change anything when I open up a document in design view. Why does it do this?

    I also don’t understand why VS.Net insists on adding Name attributes to Placeholders (which causes the page to throw a "Name attribute not supported" exception) and assorted other rudenesses such as this.


  3. Anonymous says:

    The point of my post was to point out that even when you edit the document, we change as little as possible in Whidbey. Even in Everett block formatting only changed if you edited the document.

    I am not aware of the Name attribute on Placeholder problem. Is this in Whidbey or VS.NET 2003?

  4. Anonymous says:

    Please, don’t insert nbsp everywhere. Another thing that bothers me in whidbey, that you have by default div tag inside of the form when you just create a new page. I never asked for that. As you say, if I don’t explicitly ask I don’t want that thing to appear.

  5. Anonymous says:

    Thank you!!!

  6. Anonymous says:

    Sometimes we have to put an nbsp to preserve the spacing that is shown in design view. HTML condenses spaces, so if you have two spaces side by side, we have to save that using nbsp.

    Another reason you see nbsp is because empty block tags show as no space in the browser. So we have to put a non breaking space inside empty tags like these, or they will not display the same at browse time and run time.

    The default div tag is not added by design view. It is part of the standard aspx template.

  7. Anonymous says:

    You mean to <br/> or not to <br/> surely?


  8. Anonymous says:

    I just want to know if there will be an option to turn off all auto formatting of any kind. I only want what I put inside of my html. I don’t really care about double line spaces next to each other, that should be my problem to work out, not the editors. Next thing you know the editor will be cussing at me and arguing with me about my use of html. One checkbox will suffice "Auto Formatting Off". Thanks.

  9. Anonymous says:


    Please make it <br/> though!

Comments are closed.

Skip to main content