Computer ScienceNEB 2076 (old course)
Explain the <OL tag and <img tag with its properties and values. [2.5+2.5]
5Answer
Explanation of <OL> and <img> Tags with Properties and Values
1. <OL> Tag (Ordered List)
The <OL> tag in HTML is used to create an ordered list (numbered list). Each item in the list is marked with a number, letter, or Roman numeral by default.
Syntax:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Key Properties and Attributes:
| Attribute | Description | Example Values |
|---|---|---|
type |
Specifies the type of numbering | 1 (default), A, a, I, i |
start |
Sets the starting number of the list | start="5" (starts from 5) |
reversed |
Reverses the order of the list | reversed (numbers in descending order) |
Example:
<ol type="A" start="3">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output:
C. First item
D. Second item
E. Third item
2. <img> Tag (Image)
The <img> tag in HTML is used to embed an image in a webpage. It is a self-closing tag and must include the src attribute to specify the image source.
Syntax:
<img src="image.jpg" alt="Description" width="200" height="150">
Key Properties and Attributes:
| Attribute | Description | Example Values |
|---|---|---|
src |
Specifies the path of the image | src="logo.png" |
alt |
Provides alternative text if the image fails to load | alt="Company Logo" |
width |
Sets the width of the image | width="300" (in pixels) |
height |
Sets the height of the image | height="200" (in pixels) |
title |
Adds a tooltip when hovering over the image | title="Click for details" |
border |
Adds a border around the image (deprecated in HTML5) | border="2" |
loading |
Specifies lazy loading for performance | loading="lazy" |
Example:
<img src="mountain.jpg" alt="Beautiful Himalayan View" width="400" height="300" title="Click to enlarge">
Note:
- The
srcattribute is mandatory for the<img>tag. - Always include the
altattribute for accessibility and SEO. - Images can be stored locally or hosted online (e.g.,
src="https://example.com/image.jpg").
Discussion
Loading…
More Computer Science questions
What is Boolean algebra ? Describe AND and NAND gates with logic symbol, truth table and Venn diagram. [4+6]NEB 2076 (old course)10Draw the block diagram of computer system. Explain the input and processing units. [4+6]NEB 2076 (old course)10What is Operating System (OS) ? Describe its functions in brief. [2+8]NEB 2076 (old course)10What is programming language ? Describe the various types of programming language with their merits and demerits. [2+8] GROUP: B Short answer questions 9 × 5…NEB 2076 (old course)10Differentiate between analog and digital computer.NEB 2076 (old course)5Convert (513) 10 Decimal number to (..) 2 Binary number.NEB 2076 (old course)5