how to make it break lines

D

DaVinci

consider the codes
<html>
first line: there are some messages
second line: another line
</html>

how to make the two lines information appear as two lines rather than
make the two line become only one line.

the webpages should looks like:
first line: there are some messages
second line: another line

the webpages should not looks like:


first line: there are some messages second line: another line



is there any simple way to do it ?
 
J

Jonathan N. Little

DaVinci said:
consider the codes
<html>
first line: there are some messages
second line: another line
</html>

how to make the two lines information appear as two lines rather than
make the two line become only one line.

the webpages should looks like:
first line: there are some messages
second line: another line

the webpages should not looks like:


first line: there are some messages second line: another line



is there any simple way to do it ?

In a document if your want to start a new line your create a new
paragraph, right? Well, same in HTML

<p>first line: there are some messages</p>
<p>second line: another line</p>

If both are contextually in the same paragraph but your require the
second part to be on another line, happens in poetry a lot then BR
(break line)

<p>first line: there are some messages<br><second line: another line</p>
 
J

Jukka K. Korpela

Jonathan N. Little said:
In a document if your want to start a new line your create a new
paragraph, right?
Nope.

Well, same in HTML
Nope.

<p>first line: there are some messages</p>
<p>second line: another line</p>

In addition to being semantically wrong (a line does not normally constitute
a paragraph), this causes more than desired, such as vertical spacing in
graphic rendering.
If both are contextually in the same paragraph but your require the
second part to be on another line, happens in poetry a lot then BR
(break line)

<p>first line: there are some messages<br><second line: another
line</p>

It still isn't a paragraph. Using <div> would be more appropriate. Moreover,
it's somewhat more logical and potentially more useful (especially in
styling) to wrap each line inside a <div> rather than use command-like
markup like <br>. That is,

<div>first line: there are some messages</div>
<div>second line: another line</div>
 
P

pecan

Jukka K. Korpela said:
In addition to being semantically wrong (a line does not normally constitute
a paragraph), this causes more than desired, such as vertical spacing in
graphic rendering.


It still isn't a paragraph. Using <div> would be more appropriate. Moreover,
it's somewhat more logical and potentially more useful (especially in
styling) to wrap each line inside a <div> rather than use command-like
markup like <br>. That is,

<div>first line: there are some messages</div>
<div>second line: another line</div>

Is there anything wrong with using <BR>? I use it a lot, since it gives a
different spacing to the </P><P>.

CM
 
J

Jonathan N. Little

pecan said:
Is there anything wrong with using <BR>? I use it a lot, since it gives a
different spacing to the </P><P>.

If they are separate paragraphs you should use <p>...</p><p>...</p>. If
you want to adjust the space between paragraphs then you should adjust
the margins via CSS:

P { margin: .25em; }

P { margin: 0 1em; }
 
P

pecan

Jonathan said:
If they are separate paragraphs you should use <p>...</p><p>...</p>. If
you want to adjust the space between paragraphs then you should adjust
the margins via CSS:

P { margin: .25em; }

P { margin: 0 1em; }

They are separate paragraphs mostly, but sometimes I just want a
sentence on a new line. The spacing I'm talking about isn't the margin,
it's the line spacing.

CM
 
J

Jonathan N. Little

pecan said:
They are separate paragraphs mostly, but sometimes I just want a
sentence on a new line. The spacing I'm talking about isn't the margin,
it's the line spacing.

Well if they are separate paragraphs then as stated you should do as
above use <p>...</p><p>...</p>. If you do not want to compress all your
paragraphs then create a class

..compressed { margin: 0 1em; }

<p>Regular paragraph...</p>
<p class="compressed">Compressed spacing paragraph...</p>
<p class="compressed">Compressed spacing paragraph...</p>
....

If you just need to for a new line for a specific sentence the by all
means use a BR

<p>Regular paragraph...<br>but now on a new line</p>

If you need to separate a part of a paragraph with a special treatment
sort of like an inset then enclose in DIV seems to make sense to me.

..example { margin: 0 5em; color: red; }

<p>
Some technical treatise .... for example:
<div class="example">Your example...</div>
continuing rambling discourse ...
</p>
 
J

Jukka K. Korpela

pecan <[email protected]> scripsit:

[a fullquote, always a useful signal of lack of comprehensive reading]
Is there anything wrong with using <BR>?

Yes, since you had to ask.
I use it a lot, since it
gives a different spacing to the </P><P>.

Yes, you are definitely using it wrong. Try reading a primer on HTML that
explains the basic semantics of elements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top