Is there a way to use the (<p></p>
) tags without the extra space on the lines before and after the phrase? I’m using them on wordpress.com.
I’m trying to add a background color to some lines but they need to be in <p></p>
tags so an extra space is not created between the lines.
Is there a non CSS solution? I can’t modify the the CSS at the moment.
Try this:
There is no way to remove the padding & margin on p elements without the usage of css.
The easiest way to override the fact that you cant add a class or change it in a css file is to add it directly to the p element. This is not valid HTML5 though and should be avoided as much as possible.
Try this out:
You can add other styling elements within the style tag too. Things like background colors, padding, etc.
Just remember to avoid using this way it when possible.
In order to remove the default margins you can use:
However for future reference you may want to use a styles reset to prevent the default margins and paddings from being added. Then you can specify how much of a margin and padding to use. Here’s a commmonly used style reset:
http://meyerweb.com/eric/tools/css/reset/
If you want to do it without CSS, then you can do it in jQuery or JavaScript
jQuery
or
JavaScript
You can do it either way.