Page 45 - DCAP408_WEB_PROGRAMMING
P. 45
Unit 2: Creating Static Web Pages
Result: The result for the above html code is given below. Notes
This is
a para
graph with line breaks
2.1.6 Logical and Physical Markup
These examples demonstrate how you can mark-up text in an HTML document when you want
to describe its function and desired appearance.
<b>This text is bold</b> <br>
<strong> This text is strong </strong> <br>
<i>This text is italic</i> <br>
<em>This text is emphasized</em>
<p>
An example for subscript: H<sub>2</sub>O <br>
An example for superscript: x<sup>2</sup>
</p>
And this is what it will look like:
While “b” (for “bold”) and “i” (for “italics”) are physical markups (they prescribe the look of
the text), the markups “strong” and “em” (for “emphasized”) are logical markups, i.e. they
rather describe the idea behind the look. As you can see in the above example, the default
behavior of a browser is usually to display “strong” passages in bold, and “emphasized”
passages in italics. However, this default can be overridden with the help of style sheets (more
on that later).
For example, the composer of a web site might decide that emphasized text should be displayed
in bold, and strong text should be displayed in bold and in a larger font. Generally, it is better to
use logical markup than physical markup, as this describes the meaning of a text passage rather
than its look. You are more flexible that way and can reuse the same page later with different
style settings.
2.1.7 Special Characters
Certain characters, such as the angle-brackets (< >), the ampersand (&) and others are reserved
by HTML to represent special things – for example, the left angle-bracket denotes the start of an
HTML tag. If you actually want an angle-bracket to appear in your text, you need to use a special
HTML command. In addition there are many ISO-Latin 1 characters that you may wish to
include in a document, but which are not trivially available on a standard keyboard.
HTML gives you the possibility of including these special characters through certain commands.
Commands for special characters consist of three parts:
a leading ampersand character, (&),
the name of the entity (in ascii characters)
a terminating semicolon (;)
LOVELY PROFESSIONAL UNIVERSITY 39