The problem
Let $A$ and $B$ be compact subspaces of $X$ and $Y$ and $W$ an open set in $X \times Y$ containing $A \times B$. Show that there are open sets $U \supseteq A$ and $V \supseteq B$ such that $A \times B \subseteq U \times V \subseteq W.$
My attempt at a solution
Let $W = C \times D$ where $C$ and $D$ are open, $C \supseteq A, D \supseteq B$.
Let $\mathcal{A}$ be an open cover of $A$. Since $A$ is compact, there is a finite subcollection $\{ U_k \}_{k=1}^n$ of $\mathcal{A}$ still covering $A$.
Now, let $U = C \cap (U_1 \cup \dots \cup U_n)$, then $U \subseteq C$, $U$ open and $A \subseteq U$.
Likewise we can find a $V$ s.t. $V \subseteq D$, $V$ open and $B \subseteq V$.
Then we have $A \times B \subseteq U \times V \subseteq C \times D = W,$ as desired.
My question
Can I argue in this "component-wise" way? That is, can I look at $A$ and $B$ separately, or do I have to look at $A \times B$ as "one element", so to speak?