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.

Hi,

I’m having a styling problem with the following html. Can you please help me figure this out?

<table border="1">
<tr>
<td>
<p><p> </p></p><p>BEN VE AİLEM</p><p><p> </p></p><p><span style="color: rgb(91, 155, 213);">ICH UND MEINE FAMILIE</span></p><p><p> </p></p><p><span style="color: rgb(91, 155, 213);"> </span></p><p><p> </p></p><p>Tanışma</p><p><p> </p></p><p><span style="color: rgb(91, 155, 213);">Kennenlernen</span></p><p><p> </p></p><p><span style="color: rgb(84, 141, 212);"> </span></p>
</td>
</tr>
</table>

The problem also exists in the playground.

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Aymkdncommented, Dec 24, 2019

Ok. I’ll review it later this week or sometime next week.

0reactions
Aymkdncommented, Dec 26, 2019

It looks like the issue is related to PDFMake and not to my library. Inside cells, we have to use \n to have the texte on several lines (based on PDFMake website).

So, I guess you’re stuck with using <br>. You can inject <br> after your </p> in your HTML code. For example:

yourHTMLcode.replace(/<\/p>\n(\s+)?<p/g,'</p><br><p')

It will return (using your last example):

<table border="1">
  <tbody>
    <tr>
      <td align="center" valign="top">
        <p>TARİH</p><br><p style="color: blue;">DATUM</p>
      </td>
      <td align="center" valign="top">
        <p>ÜNİTE VE KONULAR</p><br><p style="color: blue;">LEKTIONEN UND THEMEN</p>
      </td>
    </tr>
  </tbody>
</table>

And, once translated by html-to-pdfmake: Capture

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it good to put <p> inside <td> to put content text?
Leave out the <p> tag unless the content of your table cell is truly a paragraph. It's certainly possible to have paragraphs in...
Read more >
Problem: p tag inside table tag - HTML & CSS - SitePoint Forums
I m facing a problem I put p tag inside table tag and tr,td tag inside p tag. When I see output in...
Read more >
How to use an HTML tag inside HTML table? - Tutorialspoint
We can easily add HTML tag inside a table. The HTML tag should be placed inside the <td> tag. For example, adding a...
Read more >
<td>: The Table Data Cell element - HTML - MDN Web Docs
The HTML element defines a cell of a table that contains data. It participates in the table model.
Read more >
HTML : Is it good to put p inside td to put content text? - YouTube
HTML : Is it good to put p inside td to put content text? 5 views 11 months ago.
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