0

I refer here to the simple command with:

<p style="text-align: center;font-size:12pt;">text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-text-as-abc-</p>

Is there a trick to use nl2br (is a command in php) for the text-as-sampling-text in order to auto-format in a given box or in a given window where abc-text is placed within this box or window.

It is to much work to place <br> manually into the text-as-sampling-news ...

... or is auto-formating until edge of window/box already working without problems in every browser with <p style="text-align: center;font-size:12pt;">text</p> without any
tag ?!

... do I need a special workout of nl2br for files in *.css ?

This questions look trivial - but I want to avoid incompatibilities with displaying text universally in all browsers.

j08691
  • 204,283
  • 31
  • 260
  • 272
dschinn1001
  • 133
  • 10
  • 1
    It depends on your CSS and HTML markup. Do you need the line breaks in specific spots or are you just trying to wrap the paragraph of text? Either way, include your HTML and CSS so we can see what we're working with here... – Dryden Long Mar 13 '14 at 21:52
  • This sounds like a possible XY problem. What are you trying to do? – Two-Bit Alchemist Mar 13 '14 at 21:52
  • is this what you're looking for ? http://stackoverflow.com/q/2919337/1113766 – Juan Mar 13 '14 at 21:54
  • hi, ... You can look non-perfect homepage at http://nosy-x.com - there in first box from up to down in center (container) - the news are not text-formatted correctly. Want to know, if I should simply leave out
    in

    text-as-abc-text-as-abc
    text-as-abc-text-as-abc

    ... would this work universally as auto-format in all browsers then ?! Or do I need to shovel more code in it (globally or locally) for index.html only ?! thx.
    – dschinn1001 Mar 14 '14 at 07:50
  • @Two-BitAlchemist - see new comment ... this is (not finish) what I tried. – dschinn1001 Mar 15 '14 at 08:15
  • It's not clear at all what you are asking or what you expect to happen. "Format" is a general word -- format how? Likewise, auto-format just means formatting programmatically. You need to be specific about what you are trying to achieve. – Two-Bit Alchemist Mar 15 '14 at 22:21
  • @Two-BitAlchemist - sorry, sometimes it is tricky to transport the German thought into the right English ... somebody told me now, that in command-tag of html

    text-text-text

    the text between the tags is in modus auto-format in given space (window or box) - I mean auto-format with that lines are breaking automatically and continue to next line one step deeper in screen. So normally I dont need to use
    then - only if I want to force a break in the line. So I wanted to know if this "auto-format" of line-breaking (within

    ) is universal through all browsers...
    – dschinn1001 Mar 17 '14 at 12:53
  • - this thread is then apparently solved, but have to test it thoroughly this week out. – dschinn1001 Mar 17 '14 at 12:55

1 Answers1

5

Not sure about what you're looking for because there's no new line within your paragraph, but in CSS white-space: pre-line implements sort of nl2br() effect:

p {
  white-space: pre-line;
}

Example Here.

It's worth noting that pre-line value is supported in IE8+.

From the MDN:

pre-line
Sequences of whitespace are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.

Hashem Qolami
  • 97,268
  • 26
  • 150
  • 164