CSS无法在Firefox中运行,但可在Chrome中使用

时间:2016-04-15 07:49:42

标签: html css firefox

以下代码适用于Chrome,但在Firefox中失败。这种风格使成功信息闪烁。



.rainbow {
  background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2), color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22));
  background-image: gradient(linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2), color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22));
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

<div class="rainbow">Success</div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

我认为对于firefox支持你需要写这样的东西。

div {
  background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
}
<div>A rainbow made from a gradient</div>

请参阅here了解更多

用于制作渐变色我总是使用this tool

答案 1 :(得分:0)

更好地使用this工具生成您想要的渐变,因为您使用它的方式无法被mozilla识别。

虽然try { InetAddress IP = InetAddress.getLocalHost(); ServerSocket serverSocket = new ServerSocket(1000); } catch (UnknownHostException e) { e.printStackTrace(); } // Run an infinite loop to check if the message is received or not. while (true) { try { Socket clientSocket = serverSocket.accept(); DataInputStream in = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream())); String message = in.readUTF(); // Get the message which send from android device. /* do other staff after getting the message . */ }atch (Exception ex) { e.printStackTrace(); } } 不适用于mozilla,因为我不存在。