I believe that content: is for content between tags. This does not work for <img> because there is no closure </img> .
Cannot change HTML attributes using CSS. You can use javascript / jquery. I have a feeling that you do not want this.
Since you already use CSS to set the URL, why not use an empty <span> or <div> instead of <img> ?
<span class="topLogo"></span> <style> .topLogo:before { height: 64px; content: url('image1.png'); transition: 0.2s; } .topLogo:before:hover { height: 64px; content: url('image2.png'); } </style>
source share