DotNetNuke Tips & Tricks

Thursday, March 26, 2009 by Cuong Dang

Developer Quick Tip: the
Element Explained

Filed under: Tips & Tricks, Module Development

As many of you may know, I work closely with the development team at Engage on various projects. One of the most common mistakes I’ve seen is that developers use <br /> (BR) to create padding between elements. Sometimes, I see big chuck of BR element being used across just to create a larger padding between their elements. This isn’t new to many developers; I often see it in many commercial modules we bought as well.

If you find yourself doing this religiously and not know what it means (some developers know what the BR element does but choose to do so), it is your time to change this bad habit by using the proper HTML tag: the <p> (P) tag.

Meet the P tag, my friends. What does it do? According to W3C:

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

Next time if you want to separate your elements, write the meaningful markup by using the P element. It just makes sense. Also, you can use CSS to control the margin and padding of the paragraphs if you want to.


Ian Robinson
Sunday, March 29, 2009 7:37 AM
I'd like to go on record saying that I haven't used a br tag in years!
Jeff B.
Sunday, March 29, 2009 8:00 AM
I seem to remember somewhere that the P element aids in SEO as well which makes sense if the P element is being used around text.
Tuesday, March 31, 2009 8:26 AM
OK, just so I'm clear here. You are NOT advocating stopping the use of the BR tag, just the Overuse of it, correct? In other words, instead of having 5 BR's in a row, you'd rather the developer use a well-placed P tag with appropriate corresponding CSS to specify the height, etc, of this tag.
Cuong Dang
Tuesday, March 31, 2009 12:03 PM
You are right, Mark.

I am sure there are certain situations that you will forced to be used the BR element. However I have not experienced it so I can't tell "never to use the BR element in module development". But before deciding whether to use BR or P, think about it for a sec and see if it makes sense to use BR vs. P in terms of SEO and CSS benefits.
Leonard Lee
Sunday, February 21, 2010 6:22 PM
ooooooh.......... are you saying what Mark is saying? if so, i'm in agreement!!!

a single
can't be as bad as

blog comments powered by Disqus