You can only use each unique id once on a web page - using one on two or more elements is invalid HTML and is likely to either cause problems, or just not work as you’ve discovered.
To apply either CSS or JavaScript to more than one HTML element, you need to use the class attribute. A single class attribute could be used dozens or even hundreds of times on the same page, and still be valid.
Your question seems to be a continuation of this topic:
If you’ve read the replies to that, you’ll know you were told it can’t be done with CSS and you will need JavaScript, so if this is the same issue, you should request this thread be moved to the JS forum.
It has already been explained to you (more than once, I’m sure) that you cannot control behaviour with CSS.