Home > Web Front-end > JS Tutorial > Force newline characters in Firefox based on javascript_javascript skills

Force newline characters in Firefox based on javascript_javascript skills

WBOY
Release: 2016-05-16 18:25:02
Original
1169 people have browsed it

Effect demonstration code:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

CSS control forced line break/force Line break

Force no line break
div{
white-space:nowrap;
}

Automatic line break
div{
word-wrap: break- word;
word-break: normal;
}

Force English word line break
div{
word-break:break-all; }<script> function toBreakWord(intLen){ var obj=document.getElementById("ff"); var strContent=obj.innerHTML; var strTemp=""; while(strContent.length>intLen){ strTemp+=strContent.substr(0,intLen)+" "; strContent=strContent.substr(intLen,strContent.length); } strTemp+=" "+strContent; obj.innerHTML=strTemp; } if(document.getElementById && !document.all) toBreakWord(37) </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template