Generalizing hover CSS code