3

CSS3 で次のような形状を動的に生成するにはどうすればよいでしょうか。

ここに画像の説明を入力

重要な側面は次のとおりであるため、境界線は無視してください。

- The gradient in the arrow body, and that the gradient lasts from the tip to the end of the arrow.
- The length of the square part will vary.

:after要素の最後に三角形を追加する通常の方法を試しましたdivが、先端と本体の両方に適切にグラデーションを適用できませんでした。

フィドル: http://jsfiddle.net/rtuY9/8/

4

1 に答える 1

3

このようなものを試すことができます-DEMO

div {
    width: 50px;
    height: 100px;
    position: relative;
    margin: 100px;

    background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 100%);
    background:    -moz-linear-gradient(top, #1e5799 0%, #2989d8 100%);
}

div:after {
    z-index: -1;
    content: "";
    display: block;
    position: absolute;
    left: -125px;
    top: -51px;
    margin: 100px;
    height: 100px;
    width: 100px;
    background: #c00;

    -webkit-transform:rotate( -45deg );
       -moz-transform:rotate( -45deg );
            transform:rotate( -45deg );

    background: -webkit-linear-gradient(45deg, #1e5799 0%, #2989d8 50%, #ffffff 50%, #ffffff 100%);
    background:    -moz-linear-gradient(45deg, #1e5799 0%, #2989d8 50%, #ffffff 50%, #ffffff 100%);
}
于 2012-12-14T22:12:51.397 に答える