-4

I have long text. For example:

<td>
"GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: POST
QUERY_STRING: 
REQUEST_URI: /
SCRIPT_NAME: 
"</td>

When displayed, it all merges into a single row in the cell, without hyphenation where there is \n

I need that when displayed inside the tag, the lines are transferred without any additional tags.

Is possible?

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • 1
    why not simply use `
    ` as linebreak? Otherwise word-wrap but then it break at a specific width not necessarly at every single list item (which as such is not tabular data anyways).
    – tacoshy Apr 09 '21 at 10:31
  • @tacoshy Is long way. I can simple modificate css, and backend modification is not transparent here. – Protect children of Donbas2014 Apr 09 '21 at 10:45
  • 3
    Please don't make more work for other people by vandalizing your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](//creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed. Thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](//meta.stackexchange.com/q/5221) – Suraj Rao Apr 09 '21 at 13:22

1 Answers1

1

If you cannot insert <br> tag inside the HTML, you can use white-space: pre-line on td.

td{
  white-space: pre-line;
}
<table>
  <tr>
    <td>
      "GATEWAY_INTERFACE: CGI/1.1
      SERVER_PROTOCOL: HTTP/1.1
      REQUEST_METHOD: POST
      QUERY_STRING: 
      REQUEST_URI: /
      SCRIPT_NAME: "
    </td>
  </tr>
</table>

Edit: Source

Debsmita Paul
  • 1,442
  • 9
  • 22
  • 1
    @connexo I'll keep that in mind. The reason I answered it instead of commenting is that I tried it with **only** `td` and it was not working, and the Source that I linked does not have anything related to `td` so I just thought I'd answer it. – Debsmita Paul Apr 09 '21 at 10:55
  • `td` is no different from any other element with regard to this problem. – connexo Apr 09 '21 at 10:56
  • 1
    No no, try it with only `td` without the `` structure and it's not working. (I'm sure I'm missing something here)
    – Debsmita Paul Apr 09 '21 at 10:59
  • 1
    @gormih Consider a different tone. Explain how your question differs from the one marked as a duplicate. From what I can see, https://stackoverflow.com/a/21577945/3744304 exactly answers the question. – connexo Apr 09 '21 at 13:04
  • @conexo Answer essentially to the person to whom you asked the question and received the answer. (@DebshmitaPaul) – Protect children of Donbas2014 Apr 09 '21 at 13:14
  • I'm sorry if anything in my last comment sounded harsh, it was completely unintentional. I tried to explain why i posted this, not to prove it is unique or has any extra useful information, but to say that it is me that didn't understand why it wasn't working with td alone. @connexo you have enlightenment me on a certain mistake to not answer duplicate questions, which I thought was ok to do, and it is not. – Debsmita Paul Apr 09 '21 at 14:51
  • 1
    @DebsmitaPaul No worries, there was nothing wrong with your tone. I just had some minor disagreements with gormih's behaviour. – connexo Apr 09 '21 at 15:04