helper function for setting css element value