0

嗨,我试着画这样的东西:

照片

使用 div 和 css,我需要分别悬停每个区域。到目前为止,我已经做了类似的事情,但它不能很好地工作,因为它会激活块并且只有两个块;/ css:

 <style type="text/css">


    .arrow-up {

      position : absolute;
      top : 150px;
      width: 150px; 
        height: 0; 
        border-left: 60px solid transparent;
        border-right: 60px solid transparent;
        border-bottom: 60px solid black;
    }
  .arrow-up:hover{
    border-bottom: 60px solid red;
}

    .arrow-down {
       position : absolute;
      top : 90px;  
      width: 150px; 
        height: 0; 
        border-left: 60px solid transparent;
        border-right: 60px solid transparent;

        border-top: 60px solid blueviolet;
    }
    .arrow-down:hover{
    border-top: 60px solid red;
    }
    .arrow-right {
        position : absolute;
       top : 90px;
      width: 0; 
        height: 0; 
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent;

        border-left: 60px solid green;
    }
    .arrow-right:hover{
    border-left: 60px solid red;
    }

    .arrow-left {
        position : absolute;
       top : 90px;
      left : 217px;
      width: 0; 
        height: 0; 
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent; 
        border-right:60px solid blue; 
    }

    .arrow-left:hover{
    border-right: 60px solid red;
    }
</style>

<html>
    <body>
       <div class="arrow-down"></div>
      <div class="arrow-up"></div>

    <div class="arrow-left"></div>
    <div class="arrow-right"></div>

    </body>
</html>

任何想法 ?可能吗 ?

演示

4

1 回答 1

0

是的,看起来很不错。删除 div:hover 选择器并使用您的类来选择元素悬停。所以:

.arrow-up:hover{
    border-bottom: 60px solid red;
}

现在将“边框”的颜色更改为红色。希望这能解决问题

你的定位:CSS:

.arrowBox{
    display:inline-block;
    width:24%;
    //for ie 5.5 to 7 
    float:left;
}

HTML:

<div class="arrowBox">
<!-- arrows go in here -->

</div>
于 2013-01-20T14:16:27.267 回答