While the CSS code is correct, you may be using the wrong classes, or something else may be overwriting your border and outline. But it’s impossible for anyone to say WHY without checking the page in question.
If you want help with this, you’re going to have to give us the specific page. That’s why the posting form asks for the URL of the page where you need help with.