If you want to do this in CSS (as implied in the question), you can do so using CSS Transitions. This is often mistakenly referred to as being part of HTML5 - it isn't; it's part of CSS. But the distinction is often blurred as they are both new and support for them is being brought into browsers together.
If you are considering using CSS Transitions though, it is important to know that they are very new and only have very limited support - ie only in one or two browsers, and even then not necessarily all features, or even properly compatible between browsers.
So if you want something that will be reliable, and will work in all current browsers, then you can't really use CSS. Your best bet would be to use a JQuery - this sort of thing is pretty easy in JQuery, and it works in every browser in use today.