Generalize CSS rule iteration for reuse