question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<p></p> gets too much space after

See original GitHub issue

Hi,

If I have some text like <p>123</p><p>456</p> the final result has like 3 or 4 break lines between the two paragraphs. I tryed to put negative margins and paddings on p tag style but with no success. Is there any way reduce that space? Thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:12
  • Comments:17

github_iconTop GitHub Comments

12reactions
raphaelvigeecommented, Jul 15, 2016

This has done the trick :

var desc = this.description
            .replace(new RegExp('<p>', 'g'), '<span>')
            .replace(new RegExp('</p>', 'g'), '</span>')
;
10reactions
fxherengcommented, Oct 9, 2017

What worked for me was to delete break lines from html text and add styles:

 htmlText = htmlText.replace(/(\r\n|\n|\r)/gm, '');

[...]

<HTMLView
            stylesheet={htmlStyles}
            addLineBreaks={false}
            value={htmlText}
          />


[...]

const htmlStyles = StyleSheet.create({
  p: {
    marginTop: 5,
    marginBottom: 5
  },
  ul: {
    marginTop: 5,
    marginBottom: 5
  },
  ol: {
    marginTop: 5,
    marginBottom: 5
  }
});


Read more comments on GitHub >

github_iconTop Results From Across the Web

Change text alignment, indentation, and spacing in PowerPoint
To change the spacing above or below a paragraph, type or click the arrows next to Before or After. · To change the...
Read more >
PowerPoint 2016: Indents and Line Spacing - GCFGlobal
When using PowerPoint line spacing is critical. ... you adjust the line spacing, so increasing the line spacing too much may cause the...
Read more >
How to reduce the space between <p> tags? - Stack Overflow
It's margin only. p tags don't use padding for their default spacing, and line-height is spacing between lines (which if decreased ...
Read more >
PowerPoint: Indents and Line Spacing - YouTube
In this video, you'll learn the basics of indents and line spacing in PowerPoint 2019, PowerPoint 2016, and Office 365.
Read more >
How to Compress PPT File Size | Reduce PowerPoint Size
In this step-by-step tutorial video, learn how to reduce the file size that a PowerPoint file takes. As an example, I take a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found