단어 구분 사용 JavaScript의 속성을 사용하여 비 CJK 스크립트에 대한 줄 바꿈 규칙을 설정합니다. 다음은 CJK 스크립트입니다. C는 중국어, J는 일본어, K는 한국어입니다.
예시
다음 코드를 실행하여 단어 나누기 구현 방법을 배울 수 있습니다. 속성 -
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 150px;
height: 120px;
background-color: lightblue;
border: 1px solid black;
}
</style>
</head>
<body>
<button onclick = "display()">Set</button>
<div id = "box">
This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.
</div>
<script>
function display() {
document.getElementById("box").style.wordBreak = "break-all";
}
</script>
</body>
</html>