0

I'm working on a html only webpage, and I am having some issues correctly formatting my social-media links. I have a fixed position div that is 48 x 190, and within it I'd like to put 4 different social media icons which link to their respective pages. I was able to set up the div correctly in css styling, and I was able to insert the images into the correct position just fine. However, as soon as I added the link tag to the image, it all broke. The formatting of the image seemed to change just by adding the link to it, and they now took up all this extra space around themselves, went outside the borders of the div, and refused to be properly centered. Why is adding a link to the image breaking the formatting in such a strange way, and how can I fix it so it remains formatted how I want even after the link is added?

Thanks!

4

2 回答 2

1

您是否将图像的边框设置为 0 ?在链接内部时,如果 CSS 中未设置此值,浏览器会为图像设置 1px 边框。

如果这不是问题,发布您的代码(例如,请参阅 jsFiddle)可能会有所帮助

于 2013-04-04T14:37:22.113 回答
0

我想,这个问题与图标的不同大小(以像素为单位)有关,这会导致增加 div 并分发 UI。我还使用了以下图像链接,它工作正常。首先确保您的图标大小。

<a href="javascript: showPopup();" id="groupEdit" class="link">
<img src="/images/redPencil.png" title="Update">
</a>
于 2013-04-04T14:50:56.077 回答