HTML: Links and Lists

20 Mar 2025

Material on links and lists in HTML

A basic guide on how to use links and lists in HTML.

๐Ÿ”— Learning Links & Lists in HTML

Links are used to connect one page to another, either within the same website or to an external site.

๐Ÿ“Œ Tags Used:

  • <a>: Anchor tag to create hyperlinks
<!-- Link to another page -->
<a href="about.html">About Us</a>

<!-- Link to an external site -->
<a href="https://www.google.com" target="_blank">Search on Google</a>

<!-- Link to a specific section on the page -->
<a href="#contact">Jump to contact section</a>

<!-- Target element -->
<h2 id="contact">Contact Us</h2>

๐Ÿงพ What Is a List in HTML?

Lists are used to display items in an organized format.

๐Ÿ“Œ Types of Lists in HTML:

Type Tag Description
Ordered List <ol> A numbered list
Unordered List <ul> A bullet-point list
Description List <dl> A list of terms and descriptions

โœ… Example of Ordered List

<ol>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ol>

โœ… Example of Unordered List

<ul>
  <li>Blog</li>
  <li>Gallery</li>
  <li>Contact</li>
</ul>

โœ… Example of Description List

<dl>
  <dt>HTML</dt>
  <dd>A markup language for the web</dd>

  <dt>CSS</dt>
  <dd>A language for styling web pages</dd>
</dl>

  • Use target="_blank" to open links in a new tab.
  • Add a title attribute to the <a> tag to provide extra info on hover.
  • Use lists to structure navigation menus.
  • Nest lists inside other lists to create submenus or nested content.

โœ… Conclusion

  • Links (<a>) are essential for connecting pages and making a site easy to navigate.
  • Lists (<ul>, <ol>, <dl>) help present information in a clean, structured format.
  • Both are fundamental HTML elements commonly used in layouts and content.

๐Ÿ’ก Master the <a>, <ul>, <ol>, and <li> tags to build well-structured navigation and content in your web pages!