Jump to content

tutorial on css confusion


rainwater

Recommended Posts

While doing this tutorial: http://www.w3schools.com/css/css_navbar.asp , I am a little confused. I am new at learning css, so please be gentle with the explination. I thought the reason for using a seperate css page was so not to have to use html in the original code of the page. In this instance, would it not mean that every page of the website would have to be written in the html part of the page in order to have the navbar be set up the same on each page? I will put the 'try it' code here.

<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
</style>
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<ul style="float:right;list-style-type:none;">
<li><a class="active" href="#about">About</a></li>
<li><a href="#login">Login</a></li>
</ul>
</ul>
</body>
</html>
Link to comment
Share on other sites

Thank you. I had a kitty like your avatar...her name was Mara.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...