2

thank you for all the years that I've never had to post a question and simply just searched!

Now, I'm trying to draw an arrow with a DIV. Example: http://i.imgur.com/wZBgv.png

So far code such as that below will draw a triangle: http://i.imgur.com/9nr3b.png

.arrow-small {
position: absolute;
bottom: 0;
left: 0;
width: 0; 
height: 0;
border-style: solid;
border-width: 80px 600px 50px 600px; 
border-color: transparent transparent blue transparent;
}

One method I've tried has been to create a smaller filled triangle to place on top of the large one which would create the arrow outline that I'm looking for, however I can not find a way to make the top div show the page background to complete the effect.

For clarity, my questions:

1) How does one create a backgroundless arrow with a div?

2) Or, how does one show the body background in a div ontop of another div that is not transparent?

4

1 に答える 1

2

jsFiddleデモ:蛍光グリーンアロー

不透明なものを他の不透明なもので覆っているので、それはうまくいかないと思います。CSS3を使用できる場合は、次のことがニーズに合う可能性があります。

<html>
  <head>
    <style>
      .chevron {
        position: absolute;
        width: 50px;
        height: 10px;
        top: 20px;
        background-color:red;
      }
      .left
      {
        left: 0px;
        -webkit-transform: rotate(340deg);
        -moz-transform: rotate(340deg);
        -o-transform: rotate(340deg);
        -ms-transform: rotate(340deg);
        transform: rotate(340deg);
      }
      .right
      {
        left: 43px;
        -webkit-transform: rotate(20deg);
        -moz-transform: rotate(20deg);
        -o-transform: rotate(20deg);
        -ms-transform: rotate(20deg);
        transform: rotate(20deg);
      }
    </style>
  </head>
  <body>
    <div class='chevron left'></div>
    <div class='chevron right'></div>
  </body>
</html>

私はこのページで変換を発見しました。これはこの質問に答えて与えられたもので、あなたに近いように聞こえます。

于 2012-12-31T04:34:48.497 に答える