Lists organise items, anchors link pages together, images add pictures, and inline frames embed other pages.
Lists in HTML
An unordered list, <ul>, shows items with bullets; each item is written in <li>. An ordered list, <ol>, numbers its items; its type attribute chooses 1, A, a, I or i, and start sets the first number. A description list, <dl>, has terms in <dt> and their descriptions in <dd>, as in a glossary. Lists can be nested by placing a list inside an <li>.
Definition: Hyperlink. A link created with the anchor element <a> that lets the user move to another page, file, section of the same page, email address or telephone number when clicked.
Anchor Tag
The anchor tag <a> creates a hyperlink. Its href attribute gives the destination: an absolute URL such as https://www.mdu.ac.in, a relative URL such as courses.html, a section of the same page such as #contact (matching an element with id="contact"), an email link mailto:office@college.edu, or a telephone link tel:+911234567890. The target="_blank" attribute opens the link in a new tab. An image can be placed inside <a> to make a clickable picture. The download attribute makes the link download a file.
Image Tag
The <img> tag embeds an image. It is an empty element. src gives the path of the image file, and alt gives alternative text, which is shown if the image cannot load and is read by screen readers, so it is essential for accessibility. width and height set the size. Common formats are JPEG for photographs, PNG for graphics with transparency, GIF for simple animations, SVG for scalable drawings and WebP for small files.
IFRAME Tag
The <iframe> (inline frame) tag embeds another web page inside the current page, such as a map, a video or another document. Its src gives the page, width and height give the size, and title describes it. A link can open a page inside a named iframe by setting its target to the iframe's name. Iframes replaced the old <frameset> and <frame> tags, which are not supported in HTML5.
Table 1.3: List types
| List | Tags | Shows |
|---|---|---|
| Unordered | <ul>, <li> | Bullets |
| Ordered | <ol>, <li> | Numbers or letters |
| Description | <dl>, <dt>, <dd> | Terms and descriptions |
Example 1.3: College page with lists, links and an iframe
Problem: Write part of a college web page that lists the departments, links to each section, and shows the library page inside an iframe when its link is clicked.
Solution:
- Use <ul> with <li> items containing <a href="#..."> links to sections.
- Give each section an id.
- Add an <iframe name="viewer"> and a link with target="viewer".
Result: The links jump to sections, and the library page opens inside the frame.
<h2>Departments</h2>
<ul>
<li><a href="#bca">Computer Applications (BCA)</a></li>
<li><a href="#bba">Management (BBA)</a></li>
</ul>
<ol type="I">
<li>Admission</li>
<li>Examination</li>
</ol>
<img src="campus.jpg" alt="College campus" width="300">
<a href="library.html" target="viewer">Open Library Page</a>
<iframe name="viewer" src="welcome.html" width="500" height="250"
title="Content viewer"></iframe>
<h3 id="bca">BCA Department</h3>
<p>Three-year degree in computer applications.</p>
Common mistakes
- Leaving out the alt attribute on images.
- Forgetting the # when linking to a section of the same page.
- Using <frameset>, which HTML5 does not support, instead of <iframe>.
Key takeaways
- <ul> gives bullets, <ol> numbers, <dl> descriptions; items go in <li>.
- <a href> creates links; target="_blank" opens a new tab.
- <img src alt> embeds an image; alt is required.
- <iframe> embeds another page inside the current one.
Practice questions
- How do you link to a section with id="contact" on the same page?
- Why is the alt attribute important?
- What does the iframe tag do?
Answers to the practice questions
- <a href="#contact">.
- It gives text shown when the image cannot load and read by screen readers.
- It embeds another web page inside the current page.
Sources
- Official BCA syllabus Web Technologies, course code 25BCA402SEC02, Unit I
