简体   繁体   中英

HTML/CSS removing little line by link when using embedded image

When I use an img tag inside of an a tag, these little lines at the bottom show up. I've tried several css properties to remove them and couldn't find one that did the trick. 在此处输入图片说明

Relevant html:

            <a href='https://github.com/'>
                <img class='ContactLink' src='Images/Icons/GitHub.png' alt='GitHub'>
            </a>
            <a href='https://twitter.com/'>
                <img class='ContactLink' src='Images/Icons/Twitter.png' alt='Twitter'>
            </a>
            <img class='ContactLink' src='Images/Icons/Gmail.png' alt='Email'>

CSS:

.ContactLink{
    height: 50px;
    width: 50px;
    border: 0;
}
///Add this code in CSS file
a {
    text-decoration:none;
}

use normalize css or try this

a,a:focus,a:hover,a:active{
   text-decoration:none;
   outline-width: 0;
}
img {
   display:inline-block;
}

I will suggest to check the image files using any tool like photoshop and see if there is any transparent pixel there for that icon. Also try to keep the dimensions of all the three icon exactly same. If required edit the image accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM