HTML I Notes
Horizontal Rule
The <HR> tag
produces a horizontal line spread across the width of the browser window.
Attributes of <HR> tag
|
Attribute |
Value |
|
Align |
Left Center right |
|
Noshade |
Noshade |
|
Size (Thickness) |
pixels |
|
Width (length of the horizontal rule) |
pixels% |
Prog1. Write html
code to display 2D and 3D horizontal rules using all its attributes.
<HTML>
<HEAD>
<TITLE> Horizontal Rules </TITLE>
</HEAD>
<BODY>
The <HR> tag produces a horizontal line spread across the width
of the browser window.
The following rules have absolute widths of 80 and 150
<HR SIZE=36 WIDTH=80 align= left> <BR>
<HR SIZE=50 WITH=200 noshade>
</BODY>
</HTML>
Comments
<!-- and -->
Comments are one type of textual content which appear in
HTML code, but are not rendered by user’s browser.
Prog2. Write HTML
code to display the usage of comments.
<HTML>
<HEAD>
<TITLE> Horizontal Rules </TITLE>
</HEAD>
<BODY>
<!-- This command will not be rendered by the browser -->
Honesty is the best policy.
Honesty is the best policy.
Honesty is the best policy.
Honesty is the best policy.
</BODY>
</HTML>
LOGICAL AND PHYSICAL
TEXT STYLES
HTML has two types of
styles for individual words or sentences: Logical and physical styles.
Logical text styles-
|
<DFN> for a word being
defined. |
Typically displayed in italics |
|
<EM> for emphasis |
Typically displayed in italics |
|
<CITE> for titles of books, films etc. |
Typically displayed in italics |
|
<CODE> for computer code |
Displayed in a fixed width
font |
|
<KBD> for user keyboard
entry |
Typically displayed in plain
fixed-width font |
|
<SAMP> for a sequence of
literal characters |
Displayed in a fixed-width
font |
|
<STRONG> for strong
emphasis |
Typically displayed in bold |
|
<VAR> for a variable |
Typically displayed in italics |
Physical Text
Styles-
<B> Bold text
<I> italic text
<TT> Typewriter text e.g.,
fixed-width font
<U> Underlined text
Special Characters-
Three ASCII characters- the left angle
bracket (<), the right angle bracket (>) and the ampersand (&) have
special meanings in HTML and therefore cannot be used as it is in text.
< the escape sequence for <
> the escape sequence for >
& the escape sequence for &
Prog3. "Write an HTML program to display text in bold, italic, and underlined styles."
<HEAD>
<TITLE> Bold, Italics, Underline </TITLE>
</HEAD>
<BODY>
<B><I><U> honesty is the best policy. </U></I></B>
</BODY>
</HTML>
Lists in HTML
Types of Lists in HTML
- Ordered (Numbered) Lists – A list with numbers.
- Unordered (Bulleted) Lists – A list with symbols or bullets
- Description (Definition) Lists – A list to write definitions or terminologies
Ordered (Numbered) Lists
- OL: The ordered lists always starts with <ol> and ends with </ol>.
- LI: LI tag specifies list items and written between <ol> and </ol>. For a number of the list items, the same number of <li> tags are required.
<html>
<head>
<title>unordered list</title>
</head>
<body>
<h2>Example of unordered list in circle</h2>
<ul type=circle>
<li>sachin</li>
<li>manoj</li>
</ul>
<h2>Example of unordered list in disk</h2>
<ul type=disk>
<li>Priya</li>
<li>Mohit</li>
</ul>
<h2>Example of unordered list in square</h2>
<ul type=square>
<li>Pinky</li>
<li>Punam</li>
</ul>
<h2>Example of unordered list in none</h2>
<ul type="none">
<li>Mukti</li>
<li>Dhama</li>
</ul>
</body>
</html>
Prog4
What is a nested list? Explain with the help of an example in HTML.
Ans . A list inside another list is known as a nested list. Nested list are useful when subcategories of the items to be listed.
Example-
<html>
<head>
<title> nested list </title>
<head>
<body>
<ol>
<li> Monday </li>
<ul>
<li> English </li>
<li> Mathematics </li>
</ul>
<li> Tuesday </li>
</ol>
</body>
</html>
Comments
Post a Comment