2014-02-12 33 views
0

情况有点长,所以我不打扰。点是,我试图将图像链接放置在背景图像顶部特定位置的不同页面上。我有背景图片,我有链接的图像出现在div中。现在的问题是,无论我如何更改参数,图像都不会改变。 这里的HTMLCSS div烦恼(边框和图像)

<div class='links' id ='canvas'> 
      <a id='anchor1' href ='index.html'><img class='one' src ="images/links/Alert-detail.png" ></a> 
      <a id='anchor2' href ='index.html'><img class='two' src ="images/links/Command-detail.png" ></a> 
      <a id='anchor3' href ='index.html'><img class='three' src ="images/links/floppy-detail.png" ></a> 
      <a id='anchor4' href ='index.html'><img class='four' src ="images/links/smiling-computer-sea-green.png" ></a> 
      <a id='anchor5' href ='index.html'><img class='five' src ="images/links/trash-detail.png" ></a> 
      <a id='anchor6' href ='index.html'><img class='six' src ="images/links/unhappy-computer-blue.png" ></a> 
      <a id='anchor7' href ='index.html'><img class='seven' src ="images/links/watch-detail.png" ></a>   
     </div> 

注意我并没有链接导致的任何地方,直到我得到的位置正确。

而CSS它

  #canvas{ 
    position:relative; 
    height: 410px; 
    width: 881px; 
    outline: 2px solid red; 
    background-image:url('../images/link layout.png'); 

    } 
    .anchor1{ 
    position:absolute; 
    top: 200px; 
    left: 100px; 
    outline: 2px solid green; 
    z-index: 15; 
     } 
+0

你想让这些链接显示在一起吗? – Victor

+0

在你的CSS中,你引用了一个'.anchor1'类,它并不存在于你的任何'' - 标签 - 这是故意的? –

回答

1

你是指.anchor1这是一类,但是你想使用#anchor1这将指向一个ID。我建议在所有<a>标签中添加一个类别,这些标签应用于lefttop属性,并将outlinez-index应用于#anchor1,#anchor2等。