答案 0 :(得分:0)
考虑到您使用的是bootstrap列布局,您可以将字符串内容分成两个相等的部分(空格作为断点),然后您可以构造一个这样的html字符串:
function splitInHalf(s){
var middle = Math.floor(s.length / 2);
var before = s.lastIndexOf(' ', middle);
var after = s.indexOf(' ', middle + 1);
if (middle - before < after - middle) {
middle = before;
} else {
middle = after;
}
var s1 = s.substr(0, middle);
var s2 = s.substr(middle + 1);
return [s1, s2];
}
var x = <you big or small string of content>;
var splitX = splitInHalf[x];
var _html = '<div class="col-lg-6">'+splitX[0]+'</div><div class="col-lg-6">'+splitX[1]+'</div>'
// Now set this _html as your html