:active
only applies while the link is being activated (while the mouse button is being pressed). It is probably working in that regard. Perhaps you are looking for a way to identify which link matches the current page and apply some styling?
<body>
...
<script>
Array.prototype.forEach.call(
document.querySelectorAll("#mainmenu a[href]"),
function(t) {
var hr = t.href.split("/").pop();
if (window.location.href.indexOf(hr) > -1)
t.className = 'active';
else
t.className = '';
}
);
</script>
</body>
And a CSS class like:
nav a.active,
nav a:active {
color: #F38000;
background-color: #101010;
}