I have a navigation bar with buttons: Here is my code (without the brackets at the beginning of li and a tags-- when I included the brackets the code ran within this post and made it a ul.) How do I make the active page (or button) a different color?
HTML code
ul
li class=“nav”> a href=“index.html”> Home
li class=“nav”> a href=“rivers.html”> Rivers
li class=“nav”> a href=“history.html”> History
/ul
Without having a link to the actual project, it’s a little hard to tell, but it does look like the . is missing from the beginning of the class. It could be as simple as that. It could be something else. If that doesn’t work, then please go ahead and post the link and we’ll take another look at it.
Assuming this code is from your index page, try the following code: This adds an “active” . class to the active li and then in your css a new section of css that applies to the active class.
I can probably debug it if I can access it. Is it a student page by chance? If so, you have to enable sharing in order for the students to have permission to share. I don’t think I have ever seen a teacher account not be able to share.
No, it is my account - I am signed in as teacher, but I still get that message. This has been an ongoing frustration - I can enable my Ss, but I can’t create a link!
I got your code by email. It looks like when you copied and pasted some of my code, the “” marks were changed from straight to curly or vice versa … at any rate, when I pasted your code into weblab and retyped the quotation marks, I was able to get it part of the way there…
Then, I had to make some adjustments to the css (both yours and mine) to get it to look the way it does now… but, here’s my version
Let me know if this is closer to what you were hoping for… (of course the other pages are missing as is the image as I don’t have those).
Also, it’s hard to see, but after you click on the link, look for the “view code” at the bottom of the page in the footer to see the code that I used to get this page.
I’ve noticed some differences when I have students working on Chromebooks. I have to check that their keyboard is set to a US keyboard instead of an international keyboard (INTL). The quotation marks are different on the international keyboard than they are on a US one. It only seems to happen on Chromebooks because the settings are so readily available. Just a thought.