I want my h3 element to be vertically centred within the div element. I tried several solutions but any of those didn't work. Could anyone figure it out for me where I am doing wrong?
Below is my html and CSS code snippet.
HTML:
<div id="test">
<h3 id="test_h3">This is a text</h3>
</div>
CSS:
#test{
height: 100px;
background-color: cadetblue;
text-align: center;
}
#test_h3{
vertical-align: middle;
}
#test{
height: 100px;
background-color: cadetblue;
text-align: center;
}
#test_h3{
vertical-align: center;
}
<div id="test">
<h3 id="test_h3">This is a text</h3>
</div>