By the end of this lesson, students will be able to:
<nav>, <ul>, <li>, <a>).
Explain the semantic use of the <nav> element. Demonstrate building a simple list using <ul> and <li>, and how each list item can contain an anchor (<a>) for links.
Example Code:
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
We have introduced basic styling concepts: colors, fonts, padding, margins, and layout (e.g., horizontal alignment using display: inline-block or flexbox). Walk through a simple CSS example to style the navigation bar.
Example CSS:
nav ul {
list-style: none;
background: #333;
display: flex;
padding: 0;
margin: 0;
}
nav ul li {
flex: 1;
}
nav ul li a {
display: block;
padding: 14px 20px;
color: white;
text-align: center;
text-decoration: none;
}
nav ul li a:hover {
background: #555;
}