Hi there,
I’ve just started to design my website using CSS to control the layout. Does anybody know how to use css to highlight a particular navigation button to show that you are currently on that page? For example I got Home, About Us, Products…etc and when I go to About Us page, I want the “About Us” button to be highlighted in different colour.
All my navigation buttons are in navigation div so I’m not sure how to change that one particular button based on the page you are on. I will really appreciate it if somebody can help me asap. thanks in advance.
sometimes I’m a bit confused on when to use id or class. I know that one document cannot contain more than one same id but in this situation, id and class will work the same way right?
KSNG, there are two things to remember about IDs versus classes:
1: IDs can only be used once in a page. Classes can be used as many times as you like.
2. IDs have much more precedence in a stylesheet “cascade” than classes.
Other than that, they work pretty much the same way.
In the example I did above, if I wanted two or more instances of that “navlist” on a single page, I’d change the ID to a class. Same if I wanted more than one link to display as “active,” though I’ve never seen a situation crop up where I wanted that.