Base64背景图片有多行?

时间:2012-07-09 15:26:19

标签: html css

是否可以将 base64 背景图片放在多行而不是一行?如果是这样,怎么样?

我目前的身体CSS是:

body {
  background-color:  #FFFFFF;
  background-image:  url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZSURBVBhXY/iABP4jAQYqSiCbi2wsA/UkAIeAuaFCb0TzAAAAAElFTkSuQmCC);
  background-repeat: repeat;
  height: 100%;
}

1 个答案:

答案 0 :(得分:20)

将代码放在引号之间,并在断开新行之前加上反斜杠。

body {
    background-color:  #FFFFFF;
    background-image:  url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUg\
    AAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQ\
    U1BAACxjwv8YQUAAAAJcEhZcwAADs\
    MAAA7DAcdvqGQAAAAZSURBVBhXY/iABP4j\
    AQYqSiCbi2wsA/UkAIeAuaFCb0TzAAAAAElFTkSuQmCC');
    background-repeat: repeat;
    height: 100%;
}