Links and Basic Navigation
Hyperlinks
Use the ... tag to create clickable links. The href attribute specifies the destination, and the text between the tags is what users see.
Example
Visit Example
Links to Other Pages
For internal navigation, use relative paths to link to other pages within your site:
About Us
Navigation Menus
You can wrap links inside a list to create a simple navigation bar:
Best Practices
- Descriptive text: Use meaningful link text like
About Usinstead of “Click here.” - Accessibility: Ensure links are keyboard?navigable and provide clear focus styles.
- SEO: Internal linking helps search engines understand your site’s structure.
- External links: Use
target="_blank"cautiously to open links in new tabs, and always pair withrel="noopener"for security.
Hands On Exercise
Create a navigation menu with three pages: Home, Services, and Contact. Save each page as index.html, services.html, and contact.html, then link them together using tags inside a list.