<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>CSS vertical-align Property</h1>
<div><img src="apple.png">- This is apple.</div>
<button onclick="myFunction()">Click Me</button>
<script>
var x = document.getElementsByTagName("img")[0];
function myFunction(){
x.style.verticalAlign = "middle";
}
</script>
<p><strong>Note</strong>: click on the button to change the 'vertical-align' from baseline to middle.</p> </body>
</html>