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

XHTML 1.0 Tutorials - Understanding In-line Elements and Tags

By: FYICenter.com

Part:   1  2  3  4  

(Continued from previous part...)

Here is a good tutorial example of "big" and "small" elements:

<?xml version="1.0" ?>
<?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>BIG and SMALL Elements</title>
 </head>
 <body>
  <p><big>.</big><small>o</small>o<small>O</small>O<big
   >O</big>O<small>O</small>o<small>o</small
    ><big>.</big><small>o</small>o<small>O</small>O<big
   >O</big>O<small>O</small>o<small>o</small
    ><big>.</big><small>o</small>o<small>O</small>O<big
   >O</big>O<small>O</small>o<small>o</small
    ><big>.</big></p>
 </body>
</html>

If you save the above document as big_and_small.html, and view it with Internet Explorer, you will see that letters are displayed in smaller, regular and bigger font sizes form a nice looking character line as shown below:
            big and small Tags

What Is a BR Tag/Element?

A "br" element is an inline element that you can use to specify a line break in the paragraph. Here are basic rules about "br" elements:

  • "br" elements are inline elements.
  • "br" elements can not be used at block level.
  • "br" elements are empty content elements.
  • Most browsers will treat "br" elements as line breaks.

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

What Is a SCRIPT Tag/Element?

A "script" element is both an inline element and a block element that you can use to specify a script code to be executed by browsers. Here are basic rules about "script" elements:

  • "script" elements are inline elements.
  • "script" elements are also block elements.
  • Most browsers will executed contents of "script" elements as script code.

Below is a good tutorial example of using "script" 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>SCRIPT Elements</title>
 </head>
 <body>
  <p>Let's ask the browser to calculate: <br/>
  sqrt(2.0) = <script type="text/javascript">
  document.write(Math.sqrt(2.0))
  </script></p>
 </body>
</html>

If you save the above document as inline_script.html, and view it with Internet Explorer, you will see that the browser calculates sqrt(2.0) correctly and displays the result as shown below:
            script Tag

What Are Other Inline Elements?

Other inline elements that are not covered in this collection:

  • a - Defining an anchor.
  • img - Defining an image.
  • map - Defining a clickable image map.
  • input - Defining an input field in a form.
  • select - Defining a selection field in a form.
  • textarea - Defining an input text area in a form.
  • label - Defining an input field label in a form.
  • button - Defining an action button in a form.
  • span - Defining a logical group of inline elements and text.

Tutorial tips on those elements will be included in other collections on this site.

Part:   1  2  3  4  


Selected Developer Jobs:

More...