Not sure where did I messed it up. Seems i can click the image that’s pointing to index even on the left of the image, as shown in the image below.
<section id="header">
<a href="index.html"><img src="resources/logo-blue.png" class="Logo" alt="Logo"></a>
[...]
</div>
</section>
and CSS:
.Logo {
display: flex;
justify-content: center;
max-width: 100px;
max-height: 100px;
padding-left: 40%;
}
I know this might be a very basic question but this is my first major project, would really appreciate your thoughts.
2
Answers
Thanks to all answering. Because of a mix of info i got from all your comments, i found what i've done wrong. I was using padding for image, instead i used the margin for container and this solved my issue. Not sure if it's the best solution long term, but it does the job for me. Thanks a lot!
To make the clickable area of the link match the visible area of the logo, you should adjust the anchor tag’s size and possibly its display properties.
I’ve made an example for you:
In this code, I added a new div element with the class LogoContainer that wraps the anchor () element and the logo image. The CSS for .LogoContainer a sets the anchor to display: block; and text-align: center;, making it cover only the visible area of the logo.
Good luck in your learning! 🙂