Linear Gradient hr效果仅适用于Firefox

时间:2013-08-30 19:07:51

标签: css css3 google-chrome

我有一个看起来像hr线的div。 这些样式仅适用于Firefox。

我创建了一个小提琴:http://jsfiddle.net/vLFN7/

<mydiv> </mydiv>
mydiv {

  background-image: -webkit-gradient(linear, left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -moz-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -ms-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -o-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    border: 0 none;
    height: 1px;
    margin: 20px 0 40px;
}

请帮忙。

2 个答案:

答案 0 :(得分:3)

jsFiddle Demo

使用to left

时问题已解决
background-image: linear-gradient(to left, transparent,
                                  rgba(0, 0, 0, 0.1), transparent);

阅读linear-gradient - CSS documentation

答案 1 :(得分:0)

它适用于所有人。

div {
    background-image: -webkit-linear-gradient(left, transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -moz-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -ms-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: -o-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    background-image: linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
    border: 0 none;
    height: 1px;
    margin: 20px 0 40px;
}