I want to center the h3 tag which reads "my favourite song ↓" to be right above the audio player and centered, not fully to the left and not right above the audio player. I know I can remove the br line to get it closer together, but I don’t want to simply use padding, I want to be sure it’s centered correctly.
<hr>
<h3>my <u><i>favourite</i></u> song ↓</h3>
<br>
<audio controls>
<source src="audio/xyz.mp3" type="audio/mpeg">
</audio>
<hr>
4
Answers
I add code below.
You can simply do that using CSS.
I would determine the width of the audio element (300px), create a container div surrounding the audio element and the H3 and then add
text-align: center
to the H3.(You can remove the space separating the H3 from the line above it by removing the margin from the H3.)
You can see my edits below in the code snippet.