HTML / CSS: href exceeds image link - how to avoid this?

I put three HTML elements in a line using the built-in block : 2 images associated with external websites (green fields in the image below) and one div-tag with a search form - language selection.

The problem is that next to the images - on the right side - there is also a hidden link. To make it visible, I set text-decoration: underline and a blue background in active mode (see Image).

How can I limit a href to just images?

Problem: a href link exceeds image which it was meant for

The HTML is as follows:

<div id="logo">
<a href="http://website1.example">
    <img src="image1.gif">
</a>
<a href="http://website2.example">
    <img src="image2.gif">
</a>
<div id="headermodules">
    <form class="search" method="post" action="index.php">
        <input type="text" value="Suchen...">
    </form>
    <div id="languageselection">
        <ul class="languageselection">
            <li id="active_language">
                <a href="http://localhost:81/de/">Deutsch</a>
            </li>
            <li>
                <a href="http://localhost:81/en/">English
            </li>
        </ul>
    </div>
</div>
<span style="width: 100%;"></span>
</div>

CSS looks like this:

#logo
{
position: relative;
height:129px;
text-align: justify;
z-index: 0;
border-top: 0px solid #000;
}
#logo  img 
{
display: inline-block;
vertical-align: middle;
}
#logo span
{
width: 100%;
height: 0;
display: inline-block;
}
#headermodules
{
display: inline-block;
vertical-align: middle;
}
+3
source share
1 answer

a inline-block, img. img display: block. , .

#logo a { display: inline-block; }
#logo img { display: block; }
+3

All Articles