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.