Lecture3 Ak
Lecture3 Ak
• This works
– <h2><em>Bold and italic</em></h2>
• How about this
– <em><h2>Bold and italic</h2></em>
• Block-level element/tag
– define a complete section or block of text
– Can contain inline element and block-level element
• Inline elements
– Define the structure of a sequence of characters
within a line
– may not contain a block-level element
– may be used within a block
Block-Level vs. Inline Elements
• id
– unique identifier for elements
• class
– the class of the element, used to specify
similar attributes for dissimilar elements by
putting them in the same class
• style
– an inline style definition
• title
– a text to display in a tool tip
Common Attributes
• Examples 1
– <p id=“firstParag” class=“indent”
title=“This paragraph introduces
html attributes”>
– Assuming style sheet contains
– .indent { margin-right: 5%; margin-left: 5%;}
• Example 2
– <p id=“firstParag” style=“margin-
right: 5%; margin-left: 5%;”
title=“This paragraph introduces
html attributes”>
Common Attributes
• lang
– sets the language code; “en”: English, “fr”: French,
“es”: Spanish, “de”: German etc.
• dir
– sets the text direction, left to right or right to left
• <p lang=“fr” dir=“ltr”>bonjour!</p>
• accesskey
– assigns an access key to an element. An access key is
a single character from the document character set.
• tabindex
– Sets the tab order of an element
Deprecated Attributes
• Nested lists
<ul>
<li>Top Level, Item 1</li>
<li>Top Level, Item 2
<ul>
<li>Sublevel 1, Item 1
<ul>
<li>Sublevel 2, Item 1</li>
<li>Sublevel 2, Item 2</li>
</ul>
</li>
<li>Sublevel 1, Item 2</li>
</ul>
</li>
<li>Top Level, Item 3</li>
</ul>
Customizing List Display
• By default
– Text in each cell is automatically aligned to
the left
– All the cells in a column have the same width
– Width of the column is determined by the
cell with the most text in it
• <th> for “table header”
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
Tables
• External Links
– <a href=“SomeURL”>Text/image</a>
• Create a link to CS web page
– <a href=“http://www.um.edu.my/”>UMCCed at
Wisma R&D</a>
– Be careful about the quotation mark
• Internal Links
Create a place/anchor
– <a id=“SomeLabel”></a> or
<a id=“SomeLabel” name=“SomeLabel”/></a>
Link to the anchor
<a href=“#SomeLabel”>Go to some place</a>
Links