• Hello, I want to remove the paragraph from specific blocks. It’s creating too much white space around it, namely above and below the text.

    The block itself is already a paragraph it seems, I tried ‘Classic’ but that kind of block doesn’t allow me to customize the text size so it seems I’m stuck with the paragraph block?

    I can choose ‘Edit as HTML’;

    <p class=”has-big-font-size”><strong>Text</strong></p>

    But how do I go about removing the p tags, without losing the font size, strong, etc.? I’m looking for solutions to remove the excessive white space above and below the text. WordPress sure does seem to have an obsession with paragraphs.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Please share website link?

    Thread Starter RVDA55

    (@rvda55)

    Why do you need that? I just described a situation. If you go to your own WordPress website it’ll work the same way.

    Thread Starter RVDA55

    (@rvda55)

    Really? No one? Surely it must be possible?

    But how do I go about removing the p tags, without losing the font size, strong, etc.? … WordPress sure does seem to have an obsession with paragraphs.

    Your question is, perhaps, a textbook example of the XY problem. Which may explain why none of the volunteers here has ventured to answer it.

    By definition, only a paragraph block has the <p> tag. Indeed, it’s the <p> tag that makes it a paragraph. So, if you were to remove the <p> tag from the paragraph block’s output, then it ceases to be a paragraph.

    So removing <p> tags doesn’t sound like the smart thing to do, and this is surely not what you need to do.

    Luckily, you added:

    It’s creating too much white space around it, namely above and below the text. … I’m looking for solutions to remove the excessive white space above and below the text.

    It seems what you really want is to get rid of the space above and below the text. But the way to do that is NOT to remove the <p> tag.

    Rather, it’s some CSS from your theme that’s causing this: possibly some excess margin, padding or line-height. And the way to fix it is to add some custom CSS to override the theme’s CSS, and not to remove <p> tags.

    But to be able to give you such CSS code, we need to go under the hood and examine the HTML source of the specific page in question. This is why Muhammad asked you to share your site address, which you did not do.

    To summarize:

    1) If you’re convinced the way to solve your problem is to remove <p> tags, then, just keep waiting. Someone else may chip in to help you, however long it might take.

    2) But if you simply want to get rid of the white pace, then kindly provide the address of the page in question, so we can take a look and give you custom CSS code to fix the problem. There’s no way around this, unfortunately.

    Standing by to help.

    Thread Starter RVDA55

    (@rvda55)

    Thanks George,

    Some custom CSS could work. Preferably applicable to a specific paragraph, but I don’t know if that is possible. So basically a general solution that will modify any specific paragraph.

    I prefer not to give my own web address, but I can tell that I am using the VisualBlogger theme by WP Enjoy: https://demo.wpenjoy.com/visualblogger/

    Hoping that helps to solve the issue I have.

    Thanks again!

    This worked for me. If there’s a plain div tag then, for some bizarre reason, the ‘stray p tags’ dissappeared.

    <div class="removeptags">[contact-form-7 id="861" title="Contact Form"]</div>
    
    No need to even go near a style sheet, I only gave the div a class so it was easy to find in the source code
    
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove paragraph (p tag) for specific block?’ is closed to new replies.