A compound can be made up of hydrogen, oxygen, or both. Many compounds, such as water (H2O), contain both hydrogen and oxygen. Some compounds, such as methane (CH4), contain only hydrogen, while others, such as carbon dioxide (CO2), contain only oxygen.