Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index

XHTML 1.0 Tutorials - Body Tag and Block Level Tags

By: FYICenter.com

Part:   1  2  3   4  5  6 

(Continued from previous part...)

How To Control Line Breaks in a Paragraph?

By default line breaks within a paragraph are controlled by the browser. Lines will be wrapped at the right edge of the display area of the paragraph. If you want to force a line break in middle of a line, you can use the "br" elements. Below is a good tutorial example of using "br" elements:

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>Line Breaks in a Paragraph</title>
 </head>
 <body>
  <p>I love the way you look at me,<br/>
  Your eyes so bright and blue.<br/>
  I love the way you kiss me,<br/>
  Your lips so soft and smooth.</p>
 </body>
</html>

If you save the above document as line_break.html, and view it with Internet Explorer, you will see that the paragraph is broken in multiple lines as shown below:
            Line Breaks

How To Highlight One Part of a Paragraph?

If you want to hightlight one part of a paragraph, you can use the "strong" element with the "p" element. Below is a good tutorial example of using "strong" elements:

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>Using "strong" in a Paragraph</title>
 </head>
 <body>
  <p>I love to use <strong>dev.FYIcenter.com</strong>
  to learning XHTML. It is easy and fun.</p>
 </body>
</html>

If you save the above document as strong.html, and view it with Internet Explorer, you will see that dev.FYIcenter.com is highlighted in bold within the paragraph as shown below:
            Strong Element in P Elements

How To Get Extra Space between Paragraphs?

By default, browsers will give a predefined white space between two paragraphs. But if you want some extra white space between two paragraphs, you can enter an extra paragraph with a &nbsp; entity.

Note that a true empty paragraph will not give any extra white space. See the following tutorial XHTML document:

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>Extra Space between Paragraphs</title>
 </head>
 <body>
  <p>Row, row, row your boat,
  Gently down the stream.</p>
  <p></p>
  <p>Merrily, merrily, merrily, merrily,
  Life is but a dream.</p>
  <p>&nbsp;</p>
  <p>Frère Jacques, Frère Jacques, 
  Dormez vous? Dormez vous?
  Sonnez les matines, Sonnez les matines,
  Din, din, don! Din, din, don!</p>
 </body>
</html>

If you save the above document as space.html, and view it with Internet Explorer, you will see that the empty paragraph gives no extra white space. But the paragraph with a &nbsp; entity does give the extra white space you wanted as shown below:
            Space between Paragraphs

(Continued on next part...)

Part:   1  2  3   4  5  6 


Selected Developer Jobs:

More...