Bev Posted April 9, 2015 Share Posted April 9, 2015 I copied the following code from the navigation bar example and tried it in my webpage. I received an error message that stated that href was not allowed in the <li> tag. What did I do wrong? What else is needed to make it work> <!DOCTYPE html> <html> <body> <ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li><a href="#contact">Contact</a></li> <li><a href="#about">About</a></li> </ul> <p>Note: We use href="#" for test links. In a real web site this would be URLs.</p> </body> </html> Link to comment Share on other sites More sharing options...
Ingolme Posted April 9, 2015 Share Posted April 9, 2015 I don't see any errors there. Where did you see the error? Link to comment Share on other sites More sharing options...
tejasamrute Posted April 9, 2015 Share Posted April 9, 2015 (edited) can u post us the screen shot of the error?? Edited April 9, 2015 by Tezzo Link to comment Share on other sites More sharing options...
Bev Posted April 9, 2015 Author Share Posted April 9, 2015 I received these 2 messages for each occurrence. Unknown element 'a href' or element cannot be placed here. Element 'a href' cannot be nested inside element 'li'. Link to comment Share on other sites More sharing options...
musakilimanjaro Posted April 9, 2015 Share Posted April 9, 2015 can u post the corresponding css and also your html dtd Link to comment Share on other sites More sharing options...
Bev Posted April 9, 2015 Author Share Posted April 9, 2015 HERE IT IS body {background-color: #000000;}h1 {font-family: "Arial";font-size: 40px;color: #FFCC00;text-align: center;}ul {list-style-type: none;margin: 0;padding: 0;}li {display: inline;}p {font-family: "Arial";font-size: 20px;color: #FFCC00;}a:default {background-color: #FFCC00;font-family: "Arial";font-size: 40px;color: #000000;}a:hover {background-color: #FFCC00;font-family: "Arial";font-size: 40px;color: #0066FF;} <!DOCTYPE html><html><head><title>Landing Page</title><meta charset="UTF-8"></head><body><ul><li><a href="#default">HOME</a></li><li><a href="#about">ABOUT</a></li><li><a href="#campaign">CAMPAIGN</a></li> <li><a href="#videos">VIDEOS</a></li><!-- These lines are a comment for now<li><a href="suggestions.asp">SUGGESTIONS</a></li><li><a href="cartoons.asp">CARTOONS</a></li><li><a href="classifiedshome.asp">CLASSIFIEDS</a></li><li><a href="store.asp">STORE</a></li><li><a href="contact.asp">CONTACT</a></li>--></ul><h1>TEST</h1><h2>THIS SITE IS CURRENTLY UNDER CONSTRUCTION</h2></body></html> Link to comment Share on other sites More sharing options...
Bev Posted April 9, 2015 Author Share Posted April 9, 2015 I have been using Microsoft Web Matrix to test my code and am beginning to wonder if it is my problem. Would you please suggest another application to test my code. I don't have server manager on my laptop. Link to comment Share on other sites More sharing options...
Ingolme Posted April 10, 2015 Share Posted April 10, 2015 Just open your HTML files in a real browser. If you want to check whether the code is valid or not, use http://validator.w3.org/ Link to comment Share on other sites More sharing options...
Techneut Posted April 10, 2015 Share Posted April 10, 2015 I can't see any error occuring in your code, it's just that you have not completed your job. Link to comment Share on other sites More sharing options...
Bev Posted April 10, 2015 Author Share Posted April 10, 2015 Thank you. 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