R.I.

.?

By Deane Barker on November 11, 2002

Is it time to put the P tag to rest? It does the exact same thing as a DIV, but it adds spacing below the tag by default. Essentially, you could have a DIV and a style rule of DIV { margin-bottom: 10px; } and it would do the exact same thing. This would have the added benefit of letting you control the spacing.

The one thing that will likely keep the P tag around is that it’s the default tag inserted when the author presses Enter in a WYSIWYG editor. Why is this? Why doesn’t an editor insert a DIV instead? Well, now that you mention it…

Twice in the last 24 hours, I’ve seen editors that ignore or suppress the P tag. Web Weaver inserts a DIV tag by default when the author presses Enter. Macromedia Contribute does it a little more stupidly. It inserts “P style=’margin-bottom: 0px;’>”. This strikes me as more than a little dumb. Why not just insert a P and overwide the bottom-margin in the style sheet? What if I want different spacing? The style is now inline with the tag, and I have to do some !IMPORTANT stuff to override it. Now, to be fair, you can override this, and just go back to a regular P tag, but doesn’t this code acrobatics tell us something?

I think the P tag’s effective lifespan is over. Editors should just insert a DIV tag, and developers can set a DIV style on their stylesheet to get the spacing they want.

Update: I was just playing around with Mozilla Composer (the default editor packaged into Mozilla). That editor enters a BR tag with every press of the Enter key.

Gadgetopia

Comments

  1. I don’t think the P tag is dead or should be dead. HTML is no longer a markup that should be relied on for a desired formatting and should only be used to identify the type of information that is contained within. As you stated you can add a style rule for p in your style sheet and override the default behavior, imho this is less work than creating a paragraph class with margin-bottom:10px; and then adding a class statement to a div everytime you want a paragraph. The important thing to realize is that the p tag signifies what kind of information is inside of it and not how it should be displayed. In a perfect world no html markup tags would have any default formatting or styles and all formatting would be handled in a style sheet this would help many of us with the transition to css and also force us to remember that the markup has meaning beyond how the content is being displayed.

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.