Carry text in HTML code?

I know to set the value of text in HTML it has to be something like

<div>hello world<div>

But how to I get it to actually read when I carry it? Like this

<div>Hello
World<div>

So that the when I carry it, I can see it.

If you are trying to add a newline you can use <br> so it would look like

<div>Hello<br>World</div>

I’m not sure what you mean by “carry it”, please elaborate.

You should really use separate elements of you want things to be separated, such as on separate lines. In this situation all I’d do is (if you’re set on using a div):

<div>hello</div>
<div>world</div>

Try to stay away from <br> its just bad practise.

Something else you could do, if you want them to be in the same div would be:

<div>
    <p>hello</p>
    <p>world</p>
</div>

True, I know that, what I mean is I am using a fetch request to retrieve text data, (.txt) and even though the text has newlines, (in my case, carrying), the fetch request outputs with no newlines, and only prints out my text straight through with no newlines and only wraps when it hits the edge.

Perhaps, the text does have newlines, but you’re not displaying them.

Try either putting the text inside of a pre tag (rather than a div), or setting the div with white-space: pre-wrap;

Remember, I am completely writing all the data in a simple text file. Would adding those parameters comply?

What do you mean by comply here?

I mean would it work?

Well it should do, that’s why I suggested it. Why don’t you try it?

Thank you. I will try and see if this helps.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.