Jump to content

Strip margin from p tags


jwhite68

Recommended Posts

I want to be able to strip the MARGIN elements from the <P> tags.

Currently, I use strip tags to remove the <P> elements completely, but have found that this results in a poorer display of the clients data, since its ignoring paragraphs.

 

What I actually want to do is just ignore the MARGIN settings within the P tags.  Does anyone know how I can achieve this?

Link to comment
https://forums.phpfreaks.com/topic/70595-strip-margin-from-p-tags/
Share on other sites

The source text with the margin information can vary.

 

Its containted within a description field, which my customers provide in HTML format.

Here is one example.  But the margin parameters could be set to anything, and the margin info could appear anywhere in the string. So it needs to be removed from every occurence in the string wherever it is.

 

<P class=MsoNormal style=MARGIN: 0in 0in 0pt;

 

Any ideas?

 

 

 

 

It sounds quite tricky, you can probably do it using a few explodes or str_replaces but as I said, quite trick

 

How do the margin elements get in there ni the first place, maybe you should look at it that way. Kill it before it gets in and merged with your p tags

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.