Wednesday, April 27, 2011

HTML: Line Arrangement

Program

<html>
<head>
            <title>Example Program</title>
</head>

<body>
            What is your name?
            My name is Olivia.
</body>
</html>

 
Result




















Though the sentences are not in the different line but there have a space between the two sentence. Look at the another program:

Program

<html>
<head>
            <title>Example Program</title>
</head>

<body>
            What is your name?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;My name is Olivia.
</body>
</html>


Result




















Here, &nbsp; is used to create more line space. If you want to keep a line space before the sentence, just use it before the sentence. The meaning of &nbsp; is ampersand next break space.


Use of <br> Tag

<br> tag is used to create line break. There has no ending of this tag. See the program:


Program

<html>
<head>
            <title>Example Program</title>
</head>

<body>
            First Line<br>Second Line<br>Third Line
</body>
</html>


Result



















Use of PRE Tag

This tag(<pre>….</pre>) is also used to create line break. By using this tag you can easily create the line break. See the program:


Program

<html>
<head>
            <title>Use of PRE Tag</title>
</head>

<body>
            <pre>
                        First Line
                        Second Line
                        Third Line
            </pre>
</body>
</html>


Result


No comments:

Post a Comment