使用CSS移动图像/链接

时间:2013-03-06 05:07:28

标签: html css image hyperlink

我需要帮助解决我正在建设的网站遇到的这个小问题。我有一个图像列表,其中包含指向不同网站的链接,大部分内容看起来都很好但是当我将鼠标悬停在行中的最后一个上面时,下面的链接会因某些奇怪的原因而移动。我想不出来!

想象一下它最初的样子:

[img1] [img2] [img3]
[img4] [img5] [img6]

当我将鼠标悬停在右侧的任何图像/链接上时会发生这种情况:

[img1] [img2] [img3]
              [img4]
[img5] [img6] [img7]

这是我的代码:

.sites{
float:left;
width:215px;
background: #eee;
text-align:center;
margin: 0px 13px 15px 0px;
border: 1px solid #ccc;
padding:10px;
}

.sites p{
margin:0px;
padding:10px;
font:bold;
}

.sites a{
border-bottom: 5px solid #000;
border-top: 5px solid #000;
display:block;
}

.sites a:hover{
border-bottom: #F90;
border-top: #f90;
}

这是我的HTML:

<div id="main-content">    
<h1> Check out all our DEADicated sites: </h1>
<div class="sites">
    <a href="http://www.eyeem.com/TheDEADicated" target="_blank">
    <img src="images/sites/eye-em.jpg" width="215" height="150" alt="EyeEm"/></a>
    <p> EyeEm </p>
</div>
<div class="sites">
    <a href="http://www.facebook.com/DeadSaraArg" target="_blank">
    <img src="images/sites/fb-argentina.jpg" width="215" height="150" alt="Facebook    Argentina"/></a>
    <p> Facebook - Argentina </p>
</div>
<div class="sites">     
    <a href="https://www.facebook.com/pages/The-DEADicated-Canada/427270554005649?ref=hl" target="_blank">
    <img src="images/sites/fb-canada.jpg" width="215" height="150" alt="Facebook Canada"/></a>
    <p> Facebook - Canada </p>
</div>

<div class="sites">
    <a href="http://www.facebook.com/ThedeadicatedEgypt" target="_blank">
    <img src="images/sites/fb-egypt.jpg" width="215" height="150" alt="Facebook Egypt"/></a>
    <p> Facebook - Egypt </p>

</div>
<div class="sites">
    <a href="http://www.facebook.com/DeadSaraItaly?ref=hl" target="_blank">
    <img src="images/sites/fb-italy.jpg" width="215" height="150" alt="Facebook Italy"/></a>
    <p> Facebook - Italy </p>
</div>
<div class="sites">     
    <a href="http://www.facebook.com/thedeadicatedmexico" target="_blank">
    <img src="images/sites/fb-mexico.jpg" width="215" height="150" alt="Facebook Mexico"/></a>
    <p> Facebook - Mexico </p>
</div>
<br/>
<div class="sites">
    <a href="http://www.facebook.com/DeadSaraTheDeadicatedUK" target="_blank">
    <img src="images/sites/fb-uk.jpg" width="215" height="150" alt="Facebook UK"/></a>
    <p> Facebook - UK </p>
</div>

</br><br><br>

<h2> To join TheDEADicated, click <a href="http://musichype.com/artists/dead-sara" target="_blank">HERE</a>! </h2>



</div> 

我对网页设计很陌生。请帮忙?

1 个答案:

答案 0 :(得分:1)

如果没有HTML,我无法肯定地说,但只是来自您的css,您的.sites a:hover规则应设置为border-top-color: #F90; border-bottom-color: #F90;,而不仅仅是边框顶部和边框底部。