 <p>Instead of using the style attribute as mentioned by RaMeSh, I would use a css attribute. That's simply cleaner.</p> <pre><code>if(logged_in === true) { echo '&lt;a class="hidden" href="/login"&gt;&lt;img style="margin-top:1px;" src="/template/img/sits_01.png"&gt;&lt;/a&gt;' } else { echo '&lt;a href="/login"&gt;&lt;img style="margin-top:1px;" src="/template/img/sits_01.png"&gt;&lt;/a&gt;' } </code></pre> <p>And in your style.css</p> <pre><code>.hidden { opacity: 0; } </code></pre> <p>Always try to avoid the <code>style</code> attribute if not 100% necessary. It makes your code less futureproof and terrible to work if you have to work with it ever again.</p>