文本上的线性渐变不是浏览器

时间:2014-10-10 16:23:59

标签: css3 text

我的问题纯粹是交叉浏览器,我几乎尝试过所有事情。从导入http://www.colorzilla.com/gradient-editor/的代码到播放每个可能的组合和前缀。

我有一个H1类,其风格(主要):

.welcome h1 {
  line-height: 1em;
  margin: 0;
  font-size: 120px;
  background: -webkit-linear-gradient(#7c6510, #b9a044, #7c6510);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: 25px;
  text-shadow: 0px 0px 17px #b9a044;
}
<div class="welcome-container"><div class="welcome text-center"><h1>Pluche Lingerie</h1></div></div>

这在Chrome和Safari中效果很好。但不是在Mozilla和IE(v11)

所以我试过这个:

.welcome h1 {
  line-height: 1em;
  margin: 0;
  font-size: 120px;
  background: -webkit-linear-gradient(#7c6510, #b9a044, #7c6510);
  background: #7c6510;
  /* Old browsers */
  /* IE9 SVG, needs conditional override of 'filter' to 'none' */
  background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdjNjUxMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2I5YTA0NCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3YzY1MTAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
  background: -moz-linear-gradient(top, #7c6510 0%, #b9a044 50%, #7c6510 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7c6510), color-stop(50%, #b9a044), color-stop(100%, #7c6510));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(top, #7c6510 0%, #b9a044 50%, #7c6510 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(top, #7c6510 0%, #b9a044 50%, #7c6510 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(top, #7c6510 0%, #b9a044 50%, #7c6510 100%);
  /* IE10+ */
  background: linear-gradient(to bottom, #7c6510 0%, #b9a044 50%, #7c6510 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#7c6510', endColorstr='#7c6510', GradientType=0);
  /* IE6-8 */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-background-clip: text;
  -moz-text-fill-color: transparent;
  -o-background-clip: text;
  -o-text-fill-color: transparent;
  -ms-background-clip: text;
  -ms-text-fill-color: transparent;
  padding-bottom: 25px;
  text-shadow: 0px 0px 17px #b9a044;
}
<div class="welcome-container"><div class="welcome text-center"><h1>Pluche Lingerie</h1></div></div>

每种组合都可能(也没有尝试为IE工作)。我得到的是IE和Mozilla中带有白色字体的漂亮背景渐变。我不知道我做错了什么,为什么:

-webkit-background-clip: text;
  	-webkit-text-fill-color: transparent;

和moz的版本,即不起作用?

谢谢!

0 个答案:

没有答案