在CSS源中拆分长文字

时间:2015-11-28 11:54:43

标签: css css3

有没有办法在多行上拆分CSS文字?我对内联图像特别感兴趣,例如这条规则功能齐全,但不易处理

.some-class { 
  background-image:url(data:image/png;base64,iVBORw0KGgoAAAAN...etc...etc...gg==)
}

2 个答案:

答案 0 :(得分:2)

试试这个:

.some-class { 
  background-image:url('data:image/png;base64,iVBORw0KGgo\
AAAAN...etc...etc...gg==')
}

环绕宽度引号比中断前的反斜杠

我在这里拆分第一行: http://jsfiddle.net/Xadvz/543/

答案 1 :(得分:1)

似乎无法使用setTimeout(function() { document.getElementById('imgSelect').click() }, 0);

否则请使用http-requests

示例:



\

.background-image {
  width: 100px;
  height: 100px;
  display: block;
  background-size: cover;
}
.first-child {
  border: 1px solid black;
  background-image: url('http://lorempixel.com/image_\
    output/animals-q-c-100-100-3.jpg');
}

.last-child {
  /*Splitting long literals*/
  background-image: url('data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulr\
    SOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7');