rainwater Posted March 4, 2016 Share Posted March 4, 2016 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 More sharing options...
davej Posted March 4, 2016 Share Posted March 4, 2016 Css can be used in three ways... http://www.w3schools.com/css/css_howto.asp ...and if you want to use the same css as the styling for several different html files then of course it makes sense to put that css in a separate file. 1 Link to comment Share on other sites More sharing options...
rainwater Posted March 4, 2016 Author Share Posted March 4, 2016 Thank you. I had a kitty like your avatar...her name was Mara. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now