5

ボックスシャドウを使用してこれを作成できますか? 今は画像ですが、これが css box-shadow でできるとしたら、私は傷ついています。

欲しい影

4

3 に答える 3

6

作業フィドル: http://jsfiddle.net/sinhayash/7dPnQ/1/

.class {
    height: 100px;
    width: 100px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;        
border-top: 3px solid rgb(16, 130, 253);
    border-bottom: 3px solid rgb(179, 216, 255);
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgb(16, 130, 253)), to(rgb(179, 216, 255)));
    background-image: -webkit-linear-gradient(#000, rgb(179, 216, 255));
    background-image:
        -moz-linear-gradient(rgb(16, 130, 253), rgb(179, 216, 255)),
        -moz-linear-gradient(rgb(16, 130, 253), rgb(179, 216, 255));
    background-image:
        -o-linear-gradient(rgb(16, 130, 253), rgb(179, 216, 255)),
        -o-linear-gradient(rgb(16, 130, 253), rgb(179, 216, 255));
    background-image: 
        linear-gradient(rgb(16, 130, 253), rgb(179, 216, 255)),
        linear-gradient(rgb(16, 130, 253),rgb(179, 216, 255));
    -moz-background-size: 3px 100%;
    background-size: 3px 100%;
    background-position: 0 0, 100% 0;
    background-repeat: no-repeat;
}

Firefox と Chrome で作業しています。

于 2013-06-17T12:45:21.213 に答える
1

これができるとは思いませんがbox-shadow、境界線と背景のグラデーションの組み合わせで実行できます。

デモ

div { 
    width: 400px;
    padding: 20px 25px;
    border-top: 5px solid #4672bb;
    border-bottom: 5px solid #b8c9e5;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;
    border-radius: 5px;
    margin: 40px auto;
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmV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MCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
    background-image: -webkit-linear-gradient(#4672bb, #b8c9e5);
    background-image:
        -moz-linear-gradient(#4672bb, #b8c9e5),
        -moz-linear-gradient(#4672bb, #b8c9e5)
    ;
    background-image:
        -o-linear-gradient(#4672bb, #b8c9e5),
        -o-linear-gradient(#4672bb, #b8c9e5)
    ;
    background-image: 
        linear-gradient(#4672bb, #b8c9e5),
        linear-gradient(#4672bb, #b8c9e5)
    ;
    -moz-background-size:5px 100%;
    background-size:5px 100%;
    background-position:0 0, 100% 0;
    background-repeat:no-repeat;
}

素晴らしいColorZilla Gradient Generatorで生成された SVG

于 2013-06-17T12:36:14.590 に答える