Extra Space After Paragraph Tags

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.

Read More

Is there a non CSS solution? I can’t modify the the CSS at the moment.

Related posts

Leave a Reply

4 comments

  1. 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:

    <p style="margin: 0;">Text</p>
    

    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.

  2. If you want to do it without CSS, then you can do it in jQuery or JavaScript

    jQuery

          $('p').css('margin','0');
    

    or

    JavaScript

     document.getElementsByTagName('p').style.margin = '0';
    

    You can do it either way.